Commit 972c4ea5 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] select_bad_process(): cleanup 'releasing' check

No logic changes, but imho easier to read.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Acked-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 28324d1d
...@@ -204,7 +204,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) ...@@ -204,7 +204,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
do_posix_clock_monotonic_gettime(&uptime); do_posix_clock_monotonic_gettime(&uptime);
do_each_thread(g, p) { do_each_thread(g, p) {
unsigned long points; unsigned long points;
int releasing;
/* /*
* skip kernel threads and tasks which have already released * skip kernel threads and tasks which have already released
...@@ -226,16 +225,15 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) ...@@ -226,16 +225,15 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
* the process of exiting and releasing its resources. * the process of exiting and releasing its resources.
* Otherwise we could get an OOM deadlock. * Otherwise we could get an OOM deadlock.
*/ */
releasing = test_tsk_thread_flag(p, TIF_MEMDIE) || if ((p->flags & PF_EXITING) && p == current) {
p->flags & PF_EXITING; chosen = p;
if (releasing) { *ppoints = ULONG_MAX;
if (p->flags & PF_EXITING && p == current) { break;
chosen = p;
*ppoints = ULONG_MAX;
break;
}
return ERR_PTR(-1UL);
} }
if ((p->flags & PF_EXITING) ||
test_tsk_thread_flag(p, TIF_MEMDIE))
return ERR_PTR(-1UL);
if (p->oomkilladj == OOM_DISABLE) if (p->oomkilladj == OOM_DISABLE)
continue; continue;
...@@ -245,6 +243,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) ...@@ -245,6 +243,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
*ppoints = points; *ppoints = points;
} }
} while_each_thread(g, p); } while_each_thread(g, p);
return chosen; return chosen;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment