• D
    oom: add per-zone locking · 098d7f12
    David Rientjes 提交于
    OOM killer synchronization should be done with zone granularity so that memory
    policy and cpuset allocations may have their corresponding zones locked and
    allow parallel kills for other OOM conditions that may exist elsewhere in the
    system.  DMA allocations can be targeted at the zone level, which would not be
    possible if locking was done in nodes or globally.
    
    Synchronization shall be done with a variation of "trylocks." The goal is to
    put the current task to sleep and restart the failed allocation attempt later
    if the trylock fails.  Otherwise, the OOM killer is invoked.
    
    Each zone in the zonelist that __alloc_pages() was called with is checked for
    the newly-introduced ZONE_OOM_LOCKED flag.  If any zone has this flag present,
    the "trylock" to serialize the OOM killer fails and returns zero.  Otherwise,
    all the zones have ZONE_OOM_LOCKED set and the try_set_zone_oom() function
    returns non-zero.
    
    Cc: Andrea Arcangeli <andrea@suse.de>
    Cc: Christoph Lameter <clameter@sgi.com>
    Signed-off-by: NDavid Rientjes <rientjes@google.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    098d7f12
oom_kill.c 13.0 KB