lkml.org 
[lkml]   [2013]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.12 042/118] mm: memcg: do not declare OOM from __GFP_NOFAIL allocations
    Date
    3.12-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Johannes Weiner <hannes@cmpxchg.org>

    commit a0d8b00a3381f9d75764b3377590451cb0b4fe41 upstream.

    Commit 84235de394d9 ("fs: buffer: move allocation failure loop into the
    allocator") started recognizing __GFP_NOFAIL in memory cgroups but
    forgot to disable the OOM killer.

    Any task that does not fail allocation will also not enter the OOM
    completion path. So don't declare an OOM state in this case or it'll be
    leaked and the task be able to bypass the limit until the next
    userspace-triggered page fault cleans up the OOM state.

    Reported-by: William Dauchy <wdauchy@gmail.com>
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Michal Hocko <mhocko@suse.cz>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    mm/memcontrol.c | 3 +++
    1 file changed, 3 insertions(+)

    --- a/mm/memcontrol.c
    +++ b/mm/memcontrol.c
    @@ -2677,6 +2677,9 @@ static int __mem_cgroup_try_charge(struc
    if (unlikely(task_in_memcg_oom(current)))
    goto bypass;

    + if (gfp_mask & __GFP_NOFAIL)
    + oom = false;
    +
    /*
    * We always charge the cgroup the mm_struct belongs to.
    * The mm_struct's mem_cgroup changes on task migration if the



    \
     
     \ /
      Last update: 2013-12-18 23:01    [W:4.751 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site