aboutsummaryrefslogtreecommitdiff
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-09-29 02:01:12 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 09:18:21 -0700
commit972c4ea59c9dbf82647ee9665d9e945241911a51 (patch)
tree11f084b503b2b539e0dba3c18e69ccdf7d722052 /mm/oom_kill.c
parent28324d1df646521256e83389244adcce98e89ff2 (diff)
[PATCH] select_bad_process(): cleanup 'releasing' check
No logic changes, but imho easier to read. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r--mm/oom_kill.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 423dcae323a..991bf0cf477 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -204,7 +204,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
do_posix_clock_monotonic_gettime(&uptime);
do_each_thread(g, p) {
unsigned long points;
- int releasing;
/*
* skip kernel threads and tasks which have already released
@@ -226,16 +225,15 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
* the process of exiting and releasing its resources.
* Otherwise we could get an OOM deadlock.
*/
- releasing = test_tsk_thread_flag(p, TIF_MEMDIE) ||
- p->flags & PF_EXITING;
- if (releasing) {
- if (p->flags & PF_EXITING && p == current) {
- chosen = p;
- *ppoints = ULONG_MAX;
- break;
- }
- return ERR_PTR(-1UL);
+ if ((p->flags & PF_EXITING) && p == current) {
+ chosen = p;
+ *ppoints = ULONG_MAX;
+ break;
}
+ if ((p->flags & PF_EXITING) ||
+ test_tsk_thread_flag(p, TIF_MEMDIE))
+ return ERR_PTR(-1UL);
+
if (p->oomkilladj == OOM_DISABLE)
continue;
@@ -245,6 +243,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
*ppoints = points;
}
} while_each_thread(g, p);
+
return chosen;
}