Re: [RFC] Arch option to touch newly allocated pages

Jeff Dike
2002-03-07T01:26:45Z

bcrl@redhat.com said:
> Go back in the thread: I suggested making it an option that the user
> has to turn on to allow his foot to be shot.

OK, this seems to be the relevant quote (and you seem to be referring to the
kernel build segfaults - correct me if I'm wrong):

bcrl@redhat.com said:
> a UML failing at startup with out of memory is better than random
> segvs at some later point when the system is under load.

I showed the kernel build segfaulting as an improvement over UML hanging,
which is the alternative behavior.

The segfaults were caused by me implementing the simplest possible response
to alloc_pages returning unbacked pages, which is to return NULL to the
caller. This is actually wrong because in this failure case, it effectively
changes the semantics of GFP_USER, GFP_KERNEL, and the other blocking GFP_*
allocations to GFP_ATOMIC. And that's what forced UML to segfault the
compilations.

A slightly fancier recovery would loop calling alloc_pages until it got a set
of already-backed pages (with some possible sleeping in alloc_pages in there).
That would preserve the blocking semantics of GFP_USER, GFP_KERNEL, et al,
and would have allowed the UML userspace (the kernel build) to continue working
as it should.

So, a slightly improved version of the patch (which I can write up if you're
interested in seeing it) would have allowed UML and its userspace to continue
running fine (albeit in less memory than it expected) in the presence of an
overcommited tmpfs.

Jeff