Messages in this thread Patch in this message | | | Date | Sun, 10 May 2009 15:07:25 -0700 (PDT) | From | David Rientjes <> | Subject | [patch 10/11 -mmotm] oom: avoid oom kill if no interruptible tasks |
| |
If there are no interruptible system tasks other than kthreads, no task should be chosen for oom kill since they won't respond to the SIGKILL anyway. Instead, we choose to simply fail page allocations if reclaim cannot free memory and hope for the best.
Signed-off-by: David Rientjes <rientjes@google.com> --- mm/oom_kill.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -209,6 +209,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, struct task_struct *g, *p; struct task_struct *chosen = NULL; struct timespec uptime; + unsigned long nr_interruptible = 0; *ppoints = 0; *freed = 0; @@ -225,6 +226,8 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, /* skip the init task */ if (is_global_init(p)) continue; + if (!(p->state & TASK_UNINTERRUPTIBLE)) + nr_interruptible++; if (mem && !task_in_mem_cgroup(p, mem)) continue; @@ -277,7 +280,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, } } while_each_thread(g, p); - return chosen; + return nr_interruptible ? chosen : ERR_PTR(-1UL); } /**
| |