linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <piggin@cyberone.com.au>
To: Paul Mackerras <paulus@samba.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Mikael Pettersson <mikpe@csd.uu.se>,
	axboe@suse.de, bernie@develer.com, linux-kernel@vger.kernel.org
Subject: Re: 2.5.75 as-iosched.c & asm-generic/div64.h breakage
Date: Sat, 12 Jul 2003 11:03:00 +1000	[thread overview]
Message-ID: <3F0F5E44.1080109@cyberone.com.au> (raw)
In-Reply-To: <16143.23320.180064.599815@cargo.ozlabs.ibm.com>

Hi!

Paul Mackerras wrote:

>Andrew Morton writes:
>
>
>>Mikael Pettersson <mikpe@csd.uu.se> wrote:
>>
>>>drivers/block/as-iosched.c: In function `as_update_iohist':
>>>drivers/block/as-iosched.c:840: warning: right shift count >= width of type
>>>drivers/block/as-iosched.c:840: warning: passing arg 1 of `__div64_32' from incompatible pointer type
>>>
>>You mean that code was in -mm for all those months and no ppc32 person
>>bothered testing it?  Bah.
>>
>
>We've only been getting those warnings since the changeover to the new
>asm-generic/div64.h.  Settle down. :)
>
>
>>Something like this?  (Could be sped up for 32-bit sector_t)
>>
>>diff -puN drivers/block/as-iosched.c~as-do_div-fix drivers/block/as-iosched.c
>>--- 25/drivers/block/as-iosched.c~as-do_div-fix	Fri Jul 11 14:00:55 2003
>>+++ 25-akpm/drivers/block/as-iosched.c	Fri Jul 11 14:00:58 2003
>>@@ -836,8 +836,10 @@ static void as_update_iohist(struct as_i
>> 		aic->seek_samples += 256;
>> 		aic->seek_total += 256*seek_dist;
>> 		if (aic->seek_samples) {
>>-			aic->seek_mean = aic->seek_total + 128;
>>-			do_div(aic->seek_mean, aic->seek_samples);
>>+			u64 seek_mean = aic->seek_total + 128;
>>+
>>+			do_div(seek_mean, aic->seek_samples);
>>+			aic->seek_mean = seek_mean;
>> 		}
>>
>
>There are several interesting aspects to this:
>
>1. For some reason the LBD config option in drivers/block/Kconfig
>   depends on X86.  (CONFIG_LBD is what makes sector_t an unsigned
>   long long instead of an unsigned long).  I think the LBD option
>   should be available on all 32-bit platforms.  Working out a neat
>   way to tell the config system that is left as an exercise for the
>   reader. :)
>

Not me :P

>
>2. It seems to me that seek_total is bounded above by 1024 * the
>   maximum seek distance.  I'm a bit concerned about that overflowing
>   32 bits - AFAICS I would only need a > 2GB disk (or do I mean
>   partition?) for that to happen.  Could we make seek_total be a u64
>   unconditionally please?
>

Probably a good idea. It is only the seek distance for one
process though. But it wouldn't hurt.

>
>3. I guess that adding 128 on to the seek_total is to get a
>   round-to-nearest effect in the division.  In fact you need to add
>   on (seek_samples >> 1) to get that effect.
>

You're right. Thanks.



  reply	other threads:[~2003-07-12  0:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-11 20:48 2.5.75 as-iosched.c & asm-generic/div64.h breakage Mikael Pettersson
2003-07-11 21:01 ` Andrew Morton
2003-07-12  0:49   ` Paul Mackerras
2003-07-12  1:03     ` Nick Piggin [this message]
2003-07-14  4:10       ` Peter Chubb
2003-07-11 21:36 Mikael Pettersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F0F5E44.1080109@cyberone.com.au \
    --to=piggin@cyberone.com.au \
    --cc=akpm@osdl.org \
    --cc=axboe@suse.de \
    --cc=bernie@develer.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).