]> git.baikalelectronics.ru Git - kernel.git/commitdiff
memcg: fix mem_cgroup_out_of_memory() return value.
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Thu, 26 May 2016 22:16:19 +0000 (15:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 May 2016 22:35:44 +0000 (15:35 -0700)
mem_cgroup_out_of_memory() is returning "true" if it finds a TIF_MEMDIE
task after an eligible task was found, "false" if it found a TIF_MEMDIE
task before an eligible task is found.

This difference confuses memory_max_write() which checks the return
value of mem_cgroup_out_of_memory().  Since memory_max_write() wants to
continue looping, mem_cgroup_out_of_memory() should return "true" in
this case.

This patch sets a dummy pointer in order to return "true".

Link: http://lkml.kernel.org/r/1463753327-5170-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c

index cf428d7b9a03a041516e613563d5d051dfc4c610..f6477a9dbe7ab42c98ff05bc4f2050d897eb6b0a 100644 (file)
@@ -1302,6 +1302,8 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
                                mem_cgroup_iter_break(memcg, iter);
                                if (chosen)
                                        put_task_struct(chosen);
+                               /* Set a dummy value to return "true". */
+                               chosen = (void *) 1;
                                goto unlock;
                        case OOM_SCAN_OK:
                                break;