[PATCH] oom-killer kills more than needed

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Date: Monday, September 29, 2008 - 7:09 pm

Signed-off-by: Chad Zanonie

This mod firstly replaces a !p->mm check with PF_KTHREAD to more
accurately identify
kthreads. Secondly, it adds a (p->state & TASK_DEAD) check to identify processes
that have released their mm entirely.  Not waiting for a process to finish
releasing its memory entirely can cause the OOM killer to kill another
application unnecessarily (while p->mm is null but memory isn't yet available).


diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 64e5b4b..f325a87 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -216,7 +216,7 @@ static struct task_struct
*select_bad_process(unsigned long *ppoints,
                 * skip kernel threads and tasks which have already released
                 * their mm.
                 */
-               if (!p->mm)
+               if (p->flags & PF_KTHREAD || p->state & TASK_DEAD)
                        continue;
                /* skip the init task */
                if (is_global_init(p))
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] oom-killer kills more than needed, Chad Zanonie, (Mon Sep 29, 7:09 pm)