Re: fork: out of memory

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 25 Nov 1997 19:26:22 +0000 (GMT)


> if (newfd >= files->cur_allocated) {
> if (newfd > files->cur_allocated) {
> /* Oops. Someone else must already be updating
> this, Not now baby.... I have a headache */
> return -ENOMEM;
> }

Ok race #1 for SMP. If you put the lock around it all then you still have to
worry about the SMP case of

if(blah->files[n]!=NULL && /* other CPU swaps here *.
blah->files[n]...)

theres a lot of those in the kernel and some are quite time critical ones
(having said that having 300K more RAM is for most users going to make it
far faster). All of these cases need to be wrapped up where they are not
already