• D
    mm, mempool: only set __GFP_NOMEMALLOC if there are free elements · f9054c70
    David Rientjes 提交于
    If an oom killed thread calls mempool_alloc(), it is possible that it'll
    loop forever if there are no elements on the freelist since
    __GFP_NOMEMALLOC prevents it from accessing needed memory reserves in
    oom conditions.
    
    Only set __GFP_NOMEMALLOC if there are elements on the freelist.  If
    there are no free elements, allow allocations without the bit set so
    that memory reserves can be accessed if needed.
    
    Additionally, using mempool_alloc() with __GFP_NOMEMALLOC is not
    supported since the implementation can loop forever without accessing
    memory reserves when needed.
    Signed-off-by: NDavid Rientjes <rientjes@google.com>
    Cc: Greg Thelen <gthelen@google.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    f9054c70
mempool.c 14.3 KB