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 Fri, 12 Dec 2008 11:48:29 +1100 Paul Mackerras <paulus@samba.org> 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 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
    >
    > The assumption is that THREAD_SIZE is a power of 2, as is PAGE_SIZE.
    >
    > I think Yuri should be increasing THREAD_SIZE for the larger page
    > sizes he's implementing, because we have on-stack arrays whose size
    > depends on the page size. I suspect that having THREAD_SIZE less than
    > 1/8 of PAGE_SIZE risks stack overflows, and the better fix is for Yuri
    > to make sure THREAD_SIZE is at least 1/8 of PAGE_SIZE. (In fact, more
    > may be needed - someone should work out what fraction is actually
    > needed.)

    OK, yes.

    It's the MAX_BUF_PER_PAGE arrays which will hurt. iirc they nest
    three-deep on some codepaths.



    \
     
     \ /
      Last update: 2008-12-12 02:11    [W:0.022 / U:121.692 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site