Re: general protection faults with 2.0.30 and filehandle patch

Michael O'Reilly (michael@metal.iinet.net.au)
21 May 1997 09:20:50 +0800


smurf@work.smurf.noris.de (Matthias Urlichs) writes:

> Andi Kleen <andi@mind.aec.at> writes:
> > Oskar Pearson <oskar@is.co.za> writes:
> >
> > > This is with 2.0.30 with the filehandle patch from
> > > www.linux.org.za/filehandle.patch.linux (or
> > > ftp://ftp.is.co.za/linux/local/filehandle.patch.linux)
> > >
> > You can't run a unpatched 2.0 kernel with 3000fds per process.
> > The sys_select() routine will overflow the kernel stack: it puts
>
> Ahem. He did mention the above patch. This patch tries to fix sys/select so
> that the stack overrun will not happen.
>
> Unfortunately, that particular patch does seem to cause trouble. I've had
> more success with my own change to fs/select.c, appended below.

[ ... ]

> + seldata = kmalloc(6*selsize,GFP_KERNEL);
> + error = -ENOMEM;
> + if(seldata == NULL)

You REALLY want to cache the results of the kmalloc().

Things that need a large select such as squid, and ircd, tend to call
select() a LOT. (squid is frequently over 150 times a second). Caching
the results of the kmalloc tends to give you a big win there.

The use of an int to handle small value of select wasn't much of a win
on the machines that I was playing with, but admittedly I was looking
at a fairly specific case (i.e. squid :).

Michael.