Re: Re[2]: [PATCH] fork_init: fix division by zero

2008-12-10 Thread Paul Mackerras
David Howells writes: > Ummm... On powerpc, I believe rotate-left would be a division as it does the > bit-numbering and the bit direction the opposite way to more familiar CPUs > such as x86. No. :) "Left" and "right" are relative to the way those of us humans in the Western European cultural

Re[2]: [PATCH] fork_init: fix division by zero

2008-12-10 Thread Yuri Tikhonov
Hello Scott, On Wednesday, December 10, 2008 you wrote: > On Wed, Dec 10, 2008 at 01:29:12PM +0300, Yuri Tikhonov wrote: >> On Wednesday, December 10, 2008 you wrote: >> > x * y / z is parsed as (x * y) / z, not x * (y / z). >> >> Here we believe in preprocessor: since all PAGE_SIZE, 8, and >

Re: Re[2]: [PATCH] fork_init: fix division by zero

2008-12-10 Thread Geert Uytterhoeven
On Wed, 10 Dec 2008, David Howells wrote: > Yuri Tikhonov <[EMAIL PROTECTED]> wrote: > > In any case, adding braces as follows probably would be better: > > > > + max_threads = mempages * (PAGE_SIZE / (8 * THREAD_SIZE)); > > I think you mean brackets, not braces '{}'. > > > Right ? > > De

Re: Re[2]: [PATCH] fork_init: fix division by zero

2008-12-10 Thread David Howells
David Howells <[EMAIL PROTECTED]> wrote: > Ummm... On powerpc, I believe rotate-left would be a division as it does the > bit-numbering and the bit direction the opposite way to more familiar CPUs > such as x86. Actually, I'm not sure that's true. Sometimes powerpc makes my head hurt:-) David

Re: Re[2]: [PATCH] fork_init: fix division by zero

2008-12-10 Thread David Howells
Yuri Tikhonov <[EMAIL PROTECTED]> wrote: > Here we believe in preprocessor: since all PAGE_SIZE, 8, and > THREAD_SIZE are the constants we expect it will calculate this. The preprocessor shouldn't be calculating this. I believe it will _only_ calculate expressions for #if. In the situation yo

Re[2]: [PATCH] fork_init: fix division by zero

2008-12-10 Thread Yuri Tikhonov
Hello Al, On Wednesday, December 10, 2008 you wrote: > On Wed, Dec 10, 2008 at 01:01:13PM +0300, Yuri Tikhonov wrote: >> >> + max_threads = mempages * PAGE_SIZE / (8 * THREAD_SIZE); >> > >> >> +#endif >> >> > Can't this overflow, e.g. on 32-bit m

Re[2]: [PATCH] fork_init: fix division by zero

2008-12-10 Thread Yuri Tikhonov
Hello Geert, On Wednesday, December 10, 2008 you wrote: > On Tue, 9 Dec 2008, Yuri Tikhonov wrote: >> The following patch fixes divide-by-zero error for the >> cases of really big PAGE_SIZEs (e.g. 256KB on ppc44x). >> Support for such big page sizes on 44x is not present in the >> current kernel