Re: [-mm patch] kernel/sched{,_fair}.c: make code static

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Andrew Morton <[email protected]> wrote:

> > Signed-off-by: Adrian Bunk <[email protected]>
> > 
> > ---
> > 
> > BTW: Please don't #include C files in sched.c
> 
> Yeah.

In this case it's not that bad. It makes the source quite a bit cleaner 
and avoids having to create artificial interfaces, global functions, 
etc. between the .o's.

> > -long div64_s(s64 divident, unsigned long divisor)
> > +static long div64_s(s64 divident, unsigned long divisor)
> 
> "divident" does appear to be a word, but I suspect "dividend" was 
> intended.

yeah indeed - fixed.

> Why is this function lurking in the CPU scheduler rather than in 
> lib/somewhere.c?
> 
> Doesn't an unsigned divide give the same result as a signed one?

no! 0xfffffff0 / 2 is 0x7fffffff when the division is unsigned, and 
7ffffff8 (== -8) when signed. On x86 the silicon only offers us unsigned 
64-bit division, so we first have to make '+16' out of -16, then divide 
by 2, and turn the +4 into -4. (On x86_64 there's no such problem, 
there's an idiv and a div 64-bit instruction as well, and gcc picks the 
right one depending on the type of the variable.)

i think Roman has recently done a nice cleanup patch that introduces 
this? I'll change CFS to use that interface once it's upstream.

	Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux