aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-09-29 05:01:12 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:21 -0400
commit972c4ea59c9dbf82647ee9665d9e945241911a51 (patch)
tree11f084b503b2b539e0dba3c18e69ccdf7d722052
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>
-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 423dcae323a5..991bf0cf4778 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)
204 do_posix_clock_monotonic_gettime(&uptime); 204 do_posix_clock_monotonic_gettime(&uptime);
205 do_each_thread(g, p) { 205 do_each_thread(g, p) {
206 unsigned long points; 206 unsigned long points;
207 int releasing;
208 207
209 /* 208 /*
210 * skip kernel threads and tasks which have already released 209 * skip kernel threads and tasks which have already released
@@ -226,16 +225,15 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
226 * the process of exiting and releasing its resources. 225 * the process of exiting and releasing its resources.
227 * Otherwise we could get an OOM deadlock. 226 * Otherwise we could get an OOM deadlock.
228 */ 227 */
229 releasing = test_tsk_thread_flag(p, TIF_MEMDIE) || 228 if ((p->flags & PF_EXITING) && p == current) {
230 p->flags & PF_EXITING; 229 chosen = p;
231 if (releasing) { 230 *ppoints = ULONG_MAX;
232 if (p->flags & PF_EXITING && p == current) { 231 break;
233 chosen = p;
234 *ppoints = ULONG_MAX;
235 break;
236 }
237 return ERR_PTR(-1UL);
238 } 232 }
233 if ((p->flags & PF_EXITING) ||
234 test_tsk_thread_flag(p, TIF_MEMDIE))
235 return ERR_PTR(-1UL);
236
239 if (p->oomkilladj == OOM_DISABLE) 237 if (p->oomkilladj == OOM_DISABLE)
240 continue; 238 continue;
241 239
@@ -245,6 +243,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
245 *ppoints = points; 243 *ppoints = points;
246 } 244 }
247 } while_each_thread(g, p); 245 } while_each_thread(g, p);
246
248 return chosen; 247 return chosen;
249} 248}
250 249