[Devel] [PATCH rh7 3/5] oom: do not ignore score of exiting tasks

Vladimir Davydov vdavydov at virtuozzo.com
Tue Apr 12 09:34:25 PDT 2016


This patch effectively backports commit 6a618957ad17 ("mm: oom_kill:
don't ignore oom score on exiting tasks").

The reason I'm doing this is that it hurts oom berserker logic. When oom
berserker enrages, it may kill quite a few tasks. All of them will soon
end in do_exit, where they can get stuck trying to acquire some mutex
(quite likely if a sort of fork bomb is running inside a container). Due
to the check removed by this patch the next oom kill will surely select
one of such tasks and hence is likely to timeout and so will the one
after the next and so on until all such tasks have been marked with
TIF_MEMDIE or exited. I.e. instead of killing more tasks we will be
wasting our time marking those that have already been killed and waiting
for them to exit. This may slow down oom berserker significantly. Since
this PF_EXITING check was removed from oom_scan_process_thread upstream
for a similar reason, let's zap it in our kernel too.

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 mm/oom_kill.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index b21641ff508e..8d1843fa86fe 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -344,14 +344,6 @@ enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
 	if (oom_task_origin(task))
 		return OOM_SCAN_SELECT;
 
-	if (task->flags & PF_EXITING && !force_kill) {
-		/*
-		 * If this task is not being ptraced on exit, then wait for it
-		 * to finish before killing some other task unnecessarily.
-		 */
-		if (!(task->group_leader->ptrace & PT_TRACE_EXIT))
-			return OOM_SCAN_SELECT;
-	}
 	return OOM_SCAN_OK;
 }
 
-- 
2.1.4



More information about the Devel mailing list