• David Rientjes's avatar
    mm, memcg: give exiting processes access to memory reserves · 0d39cce3
    David Rientjes authored
    commit 465adcf1
    
    A memcg may livelock when oom if the process that grabs the hierarchy's
    oom lock is never the first process with PF_EXITING set in the memcg's
    task iteration.
    
    The oom killer, both global and memcg, will defer if it finds an
    eligible process that is in the process of exiting and it is not being
    ptraced.  The idea is to allow it to exit without using memory reserves
    before needlessly killing another process.
    
    This normally works fine except in the memcg case with a large number of
    threads attached to the oom memcg.  In this case, the memcg oom killer
    only gets called for the process that grabs the hierarchy's oom lock;
    all others end up blocked on the memcg's oom waitqueue.  Thus, if the
    process that grabs the hierarchy's oom lock is never the first
    PF_EXITING process in the memcg's task iteration, the oom killer is
    constantly deferred without anything making progress.
    
    The fix is to give PF_EXITING...
    0d39cce3
oom_kill.c 22.3 KB