提交 38d38493 编写于 作者: S Shakeel Butt 提交者: Linus Torvalds

memcg, oom: no oom-kill for __GFP_RETRY_MAYFAIL

The documentation of __GFP_RETRY_MAYFAIL clearly mentioned that the OOM
killer will not be triggered and indeed the page alloc does not invoke OOM
killer for such allocations.  However we do trigger memcg OOM killer for
__GFP_RETRY_MAYFAIL.  Fix that.  This flag will used later to not trigger
oom-killer in the charging path for fanotify and inotify event
allocations.

Link: http://lkml.kernel.org/r/20190514212259.156585-1-shakeelb@google.comSigned-off-by: NShakeel Butt <shakeelb@google.com>
Acked-by: NMichal Hocko <mhocko@suse.com>
Cc: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 aeb309b8
...@@ -2279,7 +2279,6 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, ...@@ -2279,7 +2279,6 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
unsigned long nr_reclaimed; unsigned long nr_reclaimed;
bool may_swap = true; bool may_swap = true;
bool drained = false; bool drained = false;
bool oomed = false;
enum oom_status oom_status; enum oom_status oom_status;
if (mem_cgroup_is_root(memcg)) if (mem_cgroup_is_root(memcg))
...@@ -2366,7 +2365,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, ...@@ -2366,7 +2365,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
if (nr_retries--) if (nr_retries--)
goto retry; goto retry;
if (gfp_mask & __GFP_RETRY_MAYFAIL && oomed) if (gfp_mask & __GFP_RETRY_MAYFAIL)
goto nomem; goto nomem;
if (gfp_mask & __GFP_NOFAIL) if (gfp_mask & __GFP_NOFAIL)
...@@ -2385,7 +2384,6 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, ...@@ -2385,7 +2384,6 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
switch (oom_status) { switch (oom_status) {
case OOM_SUCCESS: case OOM_SUCCESS:
nr_retries = MEM_CGROUP_RECLAIM_RETRIES; nr_retries = MEM_CGROUP_RECLAIM_RETRIES;
oomed = true;
goto retry; goto retry;
case OOM_FAILED: case OOM_FAILED:
goto force; goto force;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册