diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2013-12-12 20:12:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-12-12 21:19:26 -0500 |
commit | a0d8b00a3381f9d75764b3377590451cb0b4fe41 (patch) | |
tree | 8e50e004aa354150558a637ff7a9d5d8ddab9b13 /mm/memcontrol.c | |
parent | f40386a4e976acb2bd3e0f9ead11e8e769acbe98 (diff) |
mm: memcg: do not declare OOM from __GFP_NOFAIL allocations
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>
Cc: <stable@vger.kernel.org> [3.12.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f1a0ae6e11b8..e3aff0175d4c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2696,6 +2696,9 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, | |||
2696 | if (unlikely(task_in_memcg_oom(current))) | 2696 | if (unlikely(task_in_memcg_oom(current))) |
2697 | goto bypass; | 2697 | goto bypass; |
2698 | 2698 | ||
2699 | if (gfp_mask & __GFP_NOFAIL) | ||
2700 | oom = false; | ||
2701 | |||
2699 | /* | 2702 | /* |
2700 | * We always charge the cgroup the mm_struct belongs to. | 2703 | * We always charge the cgroup the mm_struct belongs to. |
2701 | * The mm_struct's mem_cgroup changes on task migration if the | 2704 | * The mm_struct's mem_cgroup changes on task migration if the |