• J
    mm: page_alloc: embed OOM killing naturally into allocation slowpath · 9879de73
    Johannes Weiner 提交于
    The OOM killing invocation does a lot of duplicative checks against the
    task's allocation context.  Rework it to take advantage of the existing
    checks in the allocator slowpath.
    
    The OOM killer is invoked when the allocator is unable to reclaim any
    pages but the allocation has to keep looping.  Instead of having a check
    for __GFP_NORETRY hidden in oom_gfp_allowed(), just move the OOM
    invocation to the true branch of should_alloc_retry().  The __GFP_FS
    check from oom_gfp_allowed() can then be moved into the OOM avoidance
    branch in __alloc_pages_may_oom(), along with the PF_DUMPCORE test.
    
    __alloc_pages_may_oom() can then signal to the caller whether the OOM
    killer was invoked, instead of requiring it to duplicate the order and
    high_zoneidx checks to guess this when deciding whether to continue.
    Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
    Acked-by: NMichal Hocko <mhocko@suse.cz>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    9879de73
oom.h 2.9 KB