lkml.org 
[lkml]   [2008]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][v2] fork_init: fix division by zero
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 be quite inacccurate, because
> ((PAGE_SIZE / (8 * THREAD_SIZE)) is a small number. The way to
> preserve accuracy is
>
> max_threads = (mempages * PAGE_SIZE) / (8 * THREAD_SIZE);
>
> so how about avoiding the nasty ifdefs and doing

Are you sure? Do they actually cross the page boundaries?


\
 
 \ /
  Last update: 2008-12-11 21:31    [W:0.079 / U:3.452 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site