diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-09-29 05:01:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:21 -0400 |
commit | 28324d1df646521256e83389244adcce98e89ff2 (patch) | |
tree | aaa81642185611b4996daeba7d65e6b3c3eb05a7 /mm/oom_kill.c | |
parent | c394cc9fbb367f87faa2228ec2eabacd2d4701c6 (diff) |
[PATCH] select_bad_process(): kill a bogus PF_DEAD/TASK_DEAD check
The only one usage of TASK_DEAD outside of last schedule path,
select_bad_process:
for_each_task(p) {
if (!p->mm)
continue;
...
if (p->state == TASK_DEAD)
continue;
...
TASK_DEAD state is set at the end of do_exit(), this means that p->mm
was already set == NULL by exit_mm(), so this task was already rejected
by 'if (!p->mm)' above.
Note also that the caller holds tasklist_lock, this means that p can't
pass exit_notify() and then set TASK_DEAD when p->mm != NULL.
Also, remove open-coded is_init().
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
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.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 21f0a7e8e514..423dcae323a5 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -206,11 +206,14 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) | |||
206 | unsigned long points; | 206 | unsigned long points; |
207 | int releasing; | 207 | int releasing; |
208 | 208 | ||
209 | /* skip kernel threads */ | 209 | /* |
210 | * skip kernel threads and tasks which have already released | ||
211 | * their mm. | ||
212 | */ | ||
210 | if (!p->mm) | 213 | if (!p->mm) |
211 | continue; | 214 | continue; |
212 | /* skip the init task with pid == 1 */ | 215 | /* skip the init task */ |
213 | if (p->pid == 1) | 216 | if (is_init(p)) |
214 | continue; | 217 | continue; |
215 | 218 | ||
216 | /* | 219 | /* |
@@ -226,9 +229,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints) | |||
226 | releasing = test_tsk_thread_flag(p, TIF_MEMDIE) || | 229 | releasing = test_tsk_thread_flag(p, TIF_MEMDIE) || |
227 | p->flags & PF_EXITING; | 230 | p->flags & PF_EXITING; |
228 | if (releasing) { | 231 | if (releasing) { |
229 | /* TASK_DEAD tasks have already released their mm */ | ||
230 | if (p->state == TASK_DEAD) | ||
231 | continue; | ||
232 | if (p->flags & PF_EXITING && p == current) { | 232 | if (p->flags & PF_EXITING && p == current) { |
233 | chosen = p; | 233 | chosen = p; |
234 | *ppoints = ULONG_MAX; | 234 | *ppoints = ULONG_MAX; |