* [PATCH] memcg: fix mem_cgroup_out_of_memory() return value.
@ 2016-05-20 14:08 Tetsuo Handa
2016-05-20 15:09 ` Michal Hocko
2016-05-23 10:28 ` Vladimir Davydov
0 siblings, 2 replies; 3+ messages in thread
From: Tetsuo Handa @ 2016-05-20 14:08 UTC (permalink / raw)
To: mhocko, akpm; +Cc: linux-mm, Tetsuo Handa, Johannes Weiner, Vladimir Davydov
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".
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
---
mm/memcontrol.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b3f16ab..ab574d8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -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;
--
1.8.3.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] memcg: fix mem_cgroup_out_of_memory() return value.
2016-05-20 14:08 [PATCH] memcg: fix mem_cgroup_out_of_memory() return value Tetsuo Handa
@ 2016-05-20 15:09 ` Michal Hocko
2016-05-23 10:28 ` Vladimir Davydov
1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2016-05-20 15:09 UTC (permalink / raw)
To: Tetsuo Handa; +Cc: akpm, linux-mm, Johannes Weiner, Vladimir Davydov
On Fri 20-05-16 23:08:47, Tetsuo Handa wrote:
> 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".
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: b6e6edcfa405 ("mm: memcontrol: reclaim and OOM kill when
shrinking memory.max below usage")
But I do not think this is really worth backporting to stable tree (once
it is established).
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/memcontrol.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index b3f16ab..ab574d8 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -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;
> --
> 1.8.3.1
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] memcg: fix mem_cgroup_out_of_memory() return value.
2016-05-20 14:08 [PATCH] memcg: fix mem_cgroup_out_of_memory() return value Tetsuo Handa
2016-05-20 15:09 ` Michal Hocko
@ 2016-05-23 10:28 ` Vladimir Davydov
1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Davydov @ 2016-05-23 10:28 UTC (permalink / raw)
To: Tetsuo Handa; +Cc: mhocko, akpm, linux-mm, Johannes Weiner
On Fri, May 20, 2016 at 11:08:47PM +0900, Tetsuo Handa wrote:
> 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".
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-23 10:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20 14:08 [PATCH] memcg: fix mem_cgroup_out_of_memory() return value Tetsuo Handa
2016-05-20 15:09 ` Michal Hocko
2016-05-23 10:28 ` Vladimir Davydov
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).