oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN
Subsystems (2)
PATCH RESEND 1/1 oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN
c9f01245 (oom: remove oom_disable_count) has removed oom_disable_count counter which has been used for early break out from oom_badness so we could never select a task with oom_score_adj set to OOM_SCORE_ADJ_MIN (oom disabled).
Now that the counter is gone we are always going through heuristics calculation and we always return a non zero positive value. This means that we can end up killing a task with OOM disabled because it is indistinguishable from regular tasks with 1% resp. CAP_SYS_ADMIN tasks with 3% usage of memory or tasks with oom_score_adj set but OOM enabled.
Let's break out early if the task should have OOM disabled.
--- mm/oom_kill.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
mm/oom_kill.c +5 -0
@@ -185,6 +185,11 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,if (!p)return 0 ; +if (p->signal->oom_score_adj ==OOM_SCORE_ADJ_MIN ) { +task_unlock (p); +return 0 ; + } +/* * The memory controller may have a limit of 0 bytes, so avoid a divide * by zero, if necessary.
Signature · 8 lines
1.7.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 36 lines · Michal Hocko
c9f01245(oom: removeoom_disable_count) has removedoom_disable_countcounter which has been used for early break out fromoom_badnessso we could never select a task withoom_score_adjset toOOM_SCORE_ADJ_MIN(oom disabled).Now that the counter is gone we are always going through heuristics calculation and we always return a non zero positive value. This means that we can end up killing a task with OOM disabled because it is indistinguishable from regular tasks with 1% resp.
CAP_SYS_ADMINtasks with 3% usage of memory or tasks withoom_score_adjset but OOM enabled.Let's break out early if the task should have OOM disabled.
Signed-off-by Michal Hocko <[email protected]>Acked-by David Rientjes <[email protected]>Acked-by KOSAKI Motohiro <[email protected]>--- mm/oom_kill.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)mm/oom_kill.c +5
-0@@ -185,6 +185,11 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, if (!p) return 0; +if (p->signal->oom_score_adj ==OOM_SCORE_ADJ_MIN ) { +task_unlock (p); +return 0 ; + } +/* * The memory controller may have a limit of 0 bytes, so avoid a
Quoted 3 lines
divide
* by zero, if necessary.
This might be late, but still:
Thanks for fixing this up.
--Ying
Quoted 4 lines
--
1.7.7.1