memcg, oom: do not bypass oom killer for dying tasks
Subsystems (3)
Michal Hocko
maintainerPATCH 1/1 memcg, oom: do not bypass oom killer for dying tasks
From: Michal Hocko <[email protected]>
7775face2079 ("memcg: killed threads should not invoke memcg OOM killer") has added a bypass of the oom killer path for dying threads because a very specific workload (described in the changelog) could hit "no killable tasks" path. This itself is not fatal condition but it could be annoying if this was a common case.
On the other hand the bypass has some issues on its own. Without triggering oom killer we won't be able to trigger async oom reclaim (oom_reaper) which can operate on killed tasks as well as long as they still have their mm available. This could be the case during futex cleanup when the memory as pointed out by Johannes in [1]. The said case is still not fully understood but let's drop this bypass that was mostly driven by an artificial workload and allow dying tasks to go into oom path. This will make the code easier to reason about and also help corner cases where oom_reaper could help to release memory.
[1] https://lore.kernel.org/all/[email protected]/T/#u
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
@@ -1627,7 +1627,7 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,* A few threads which were not waiting at mutex_lock_killable() can * fail to bail out. Therefore, check again after holding oom_lock. */ - ret =task_is_dying () ||out_of_memory (&oc); + ret =out_of_memory (&oc); unlock:mutex_unlock (&oom_lock);
Signature · 1 line
2.49.0
Johannes Weiner
maintainerQuoted 18 lines · Michal Hocko
From: Michal Hocko <[email protected]>
7775face2079("memcg: killed threads should not invoke memcg OOM killer") has added a bypass of the oom killer path for dying threads because a very specific workload (described in the changelog) could hit "no killable tasks" path. This itself is not fatal condition but it could be annoying if this was a common case.On the other hand the bypass has some issues on its own. Without triggering oom killer we won't be able to trigger async oom reclaim (
oom_reaper) which can operate on killed tasks as well as long as they still have their mm available. This could be the case during futex cleanup when the memory as pointed out by Johannes in [1]. The said case is still not fully understood but let's drop this bypass that was mostly driven by an artificial workload and allow dying tasks to go into oom path. This will make the code easier to reason about and also help corner cases whereoom_reapercould help to release memory.
Quoted 4 lines
[1] https://lore.kernel.org/all/[email protected]/T/#u
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Michal Hocko <[email protected]>
Thanks, yeah, the investigation stalled out over the new years break and then... distractions.
I think we'll eventually still need the second part of [2], to force charge from dying OOM victims, but let's go with this for now.
[2] https://lore.kernel.org/all/[email protected]/
Quoted 19 lines
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/memcontrol.c +1
-1@@ -1627,7 +1627,7 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,* A few threads which were not waiting at mutex_lock_killable() can * fail to bail out. Therefore, check again after holding oom_lock. */ - ret =task_is_dying () ||out_of_memory (&oc); + ret =out_of_memory (&oc); unlock:mutex_unlock (&oom_lock);Signature · 1 line
2.49.0
Quoted 21 lines · Johannes Weiner
Quoted 20 lines · Michal Hocko
From: Michal Hocko <[email protected]>
7775face2079("memcg: killed threads should not invoke memcg OOM killer") has added a bypass of the oom killer path for dying threads because a very specific workload (described in the changelog) could hit "no killable tasks" path. This itself is not fatal condition but it could be annoying if this was a common case.On the other hand the bypass has some issues on its own. Without triggering oom killer we won't be able to trigger async oom reclaim (
oom_reaper) which can operate on killed tasks as well as long as they still have their mm available. This could be the case during futex cleanup when the memory as pointed out by Johannes in [1]. The said case is still not fully understood but let's drop this bypass that was mostly driven by an artificial workload and allow dying tasks to go into oom path. This will make the code easier to reason about and also help corner cases whereoom_reapercould help to release memory.
Quoted 8 lines
Quoted 2 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Michal Hocko <[email protected]>Thanks, yeah, the investigation stalled out over the new years break and then... distractions.
I think we'll eventually still need the second part of [2], to force charge from dying OOM victims, but let's go with this for now.
Agreed.
Quoted 5 lines
Signed-off-by Johannes Weiner <[email protected]>
Quoted 18 lines · Michal Hocko
From: Michal Hocko <[email protected]>
7775face2079("memcg: killed threads should not invoke memcg OOM killer") has added a bypass of the oom killer path for dying threads because a very specific workload (described in the changelog) could hit "no killable tasks" path. This itself is not fatal condition but it could be annoying if this was a common case.On the other hand the bypass has some issues on its own. Without triggering oom killer we won't be able to trigger async oom reclaim (
oom_reaper) which can operate on killed tasks as well as long as they still have their mm available. This could be the case during futex cleanup when the memory as pointed out by Johannes in [1]. The said case is still not fully understood but let's drop this bypass that was mostly driven by an artificial workload and allow dying tasks to go into oom path. This will make the code easier to reason about and also help corner cases whereoom_reapercould help to release memory.
Quoted 4 lines
[1] https://lore.kernel.org/all/[email protected]/T/#u
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Michal Hocko <[email protected]>