linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mm: memcg: do not declare OOM from __GFP_NOFAIL allocations
@ 2013-11-22 17:17 Johannes Weiner
  2013-11-27  1:01 ` David Rientjes
  0 siblings, 1 reply; 17+ messages in thread
From: Johannes Weiner @ 2013-11-22 17:17 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Michal Hocko, linux-mm, cgroups, linux-kernel

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>
Cc: stable@kernel.org # 3.12
---
 mm/memcontrol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 13b9d0f..cc4f9cb 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2677,6 +2677,9 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
 	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
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2013-12-04  6:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-22 17:17 [patch] mm: memcg: do not declare OOM from __GFP_NOFAIL allocations Johannes Weiner
2013-11-27  1:01 ` David Rientjes
2013-11-27  3:33   ` David Rientjes
2013-11-27 16:39     ` Johannes Weiner
2013-11-27 21:38       ` David Rientjes
2013-11-27 22:53         ` Johannes Weiner
2013-11-27 23:34           ` David Rientjes
2013-11-28 10:20             ` Michal Hocko
2013-11-29 23:46               ` David Rientjes
2013-12-02 13:22                 ` Michal Hocko
2013-12-02 23:02                   ` David Rientjes
2013-12-03 22:25                     ` Johannes Weiner
2013-12-03 23:40                       ` David Rientjes
2013-12-04  3:01                         ` Johannes Weiner
2013-12-04  4:34                           ` Dave Chinner
2013-12-04  5:25                             ` Johannes Weiner
2013-12-04  6:10                               ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).