Re: [PATCH 1/5] mm: Add __GFP_NO_OOM_KILL flag

David Rientjes
2009-05-07T22:59:29Z

On Thu, 7 May 2009, Andrew Morton wrote:

> The setting and clearing of that thing looks gruesomely racy..
>

It's not racy currently because zone_scan_lock ensures ZONE_OOM_LOCKED
gets test/set and cleared atomically for the entire zonelist (the clear
happens for the same zonelist that was test/set).

Using it for hibernation in the way I've proposed will open it up to the
race I earlier described: when a kthread is in the oom killer and
subsequently clears its zonelist of ZONE_OOM_LOCKED (all other tasks are
frozen so they can't be in the oom killer). That's perfectly acceptable,
however, since the system is by definition already oom if kthreads can't
get memory so it will end up killing a user task even though it's stuck in
D state and will exit on thaw; we aren't concerned about killing
needlessly because the oom killer becomes a no-op when it finds a task
that has already been killed but hasn't exited by way of TIF_MEMDIE.