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

2008-12-18 Thread Yuri Tikhonov
Hello Andrew, On Friday, December 19, 2008 you wrote: [snip] >> There is one more warning from the common code when I use 256KB pages: >> >>CC mm/shmem.o >> mm/shmem.c: In function 'shmem_truncate_range': >> mm/shmem.c:613: warning: division by zero >> mm/shmem.c:619: warning: division

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

2008-12-18 Thread Andrew Morton
On Thu, 18 Dec 2008 10:47:50 +0300 Yuri Tikhonov wrote: > Hello Paul, > > On Friday 12 December 2008 03:48, Paul Mackerras wrote: > > Andrew Morton writes: > > > > > > +#if (8 * THREAD_SIZE) > PAGE_SIZE > > > > max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); > > > > +#else > > >

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

2008-12-17 Thread Yuri Tikhonov
Hello Paul, On Friday 12 December 2008 03:48, Paul Mackerras wrote: > Andrew Morton writes: > > > > +#if (8 * THREAD_SIZE) > PAGE_SIZE > > > max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); > > > +#else > > > + max_threads = mempages * (PAGE_SIZE / (8 * THREAD_SIZE)); > > > +#endif > >

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

2008-12-11 Thread Nick Piggin
On Friday 12 December 2008 13:47, Andrew Morton wrote: > On Fri, 12 Dec 2008 12:31:33 +1000 Nick Piggin wrote: > > On Friday 12 December 2008 07:43, Andrew Morton wrote: > > > On Thu, 11 Dec 2008 20:28:00 + > > > > > > > Do they actually cross the page boundaries? > > > > > > Some flavours o

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

2008-12-11 Thread Andrew Morton
On Fri, 12 Dec 2008 12:31:33 +1000 Nick Piggin wrote: > On Friday 12 December 2008 07:43, Andrew Morton wrote: > > On Thu, 11 Dec 2008 20:28:00 + > > > > Do they actually cross the page boundaries? > > > > Some flavours of slab have at times done an order-1 allocation for > > objects which

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

2008-12-11 Thread Nick Piggin
On Friday 12 December 2008 07:43, Andrew Morton wrote: > On Thu, 11 Dec 2008 20:28:00 + > > Do they actually cross the page boundaries? > > Some flavours of slab have at times done an order-1 allocation for > objects which would fit into an order-0 page (etc) if it looks like > that will be b

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

2008-12-11 Thread Andrew Morton
On Fri, 12 Dec 2008 11:48:29 +1100 Paul Mackerras wrote: > Andrew Morton writes: > > > > +#if (8 * THREAD_SIZE) > PAGE_SIZE > > > max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); > > > +#else > > > + max_threads = mempages * (PAGE_SIZE / (8 * THREAD_SIZE)); > > > +#endif > > > > The ex

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

2008-12-11 Thread Paul Mackerras
Andrew Morton writes: > > +#if (8 * THREAD_SIZE) > PAGE_SIZE > > max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); > > +#else > > + max_threads = mempages * (PAGE_SIZE / (8 * THREAD_SIZE)); > > +#endif > > The expression you've chosen here can be quite inacccurate, because > ((PAGE_SI

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

2008-12-11 Thread Andrew Morton
On Fri, 12 Dec 2008 01:22:32 +0300 Yuri Tikhonov wrote: > > so how about avoiding the nasty ifdefs and doing > > I'm OK with the approach below, but, leading resulting to the same, > this involves some overhead to the code where there was no this > overhead before this patch: e.g. your implem

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

2008-12-11 Thread Yuri Tikhonov
Hello Andrew, On Thursday, December 11, 2008 you wrote: [snip] > The expression you've chosen here can be quite inacccurate, because > ((PAGE_SIZE / (8 * THREAD_SIZE)) is a small number. But why is it bad? We do multiplication to 'mempages', not division. All the numbers in the multiplier a

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

2008-12-11 Thread Andrew Morton
On Thu, 11 Dec 2008 20:28:00 + Al Viro wrote: > On Thu, Dec 11, 2008 at 12:16:35PM -0800, Andrew Morton wrote: > > > +#if (8 * THREAD_SIZE) > PAGE_SIZE > > > max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); > > > +#else > > > + max_threads = mempages * (PAGE_SIZE / (8 * THREAD_SIZE))

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

2008-12-11 Thread Al Viro
On Thu, Dec 11, 2008 at 12:16:35PM -0800, Andrew Morton wrote: > > +#if (8 * THREAD_SIZE) > PAGE_SIZE > > max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); > > +#else > > + max_threads = mempages * (PAGE_SIZE / (8 * THREAD_SIZE)); > > +#endif > > The expression you've chosen here can b

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

2008-12-11 Thread Andrew Morton
On Wed, 10 Dec 2008 19:50:51 +0300 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 big page sizes on 44x is not present in the > current kernel yet, but coming soon. > > Also this patch fixes

[PATCH][v2] fork_init: fix division by zero

2008-12-10 Thread Yuri Tikhonov
The following patch fixes divide-by-zero error for the cases of really big PAGE_SIZEs (e.g. 256KB on ppc44x). Support for big page sizes on 44x is not present in the current kernel yet, but coming soon. Also this patch fixes the comment for the max_threads settings, as this didn't match the thing