* [PATCH 1/2] v2 PF_DEAD: cleanup usage
@ 2005-11-25 16:18 Oleg Nesterov
0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2005-11-25 16:18 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, Andrew Morton
schedule() checks PF_DEAD on every context switch, and sets ->state = EXIT_DEAD
to ensure that exited task will be deactivated.
It is possible to set new ->state value in do_exit(), along with PF_DEAD flag,
and remove the check from schedule()'s hot path.
To avoid mixing ->state/->exit_state values, this patch adds new TASK_DEAD state.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.15-rc2/include/linux/sched.h~1_CLEAN 2005-11-25 20:58:09.000000000 +0300
+++ 2.6.15-rc2/include/linux/sched.h 2005-11-25 21:02:22.000000000 +0300
@@ -127,6 +127,7 @@ extern unsigned long nr_iowait(void);
#define EXIT_DEAD 32
/* in tsk->state again */
#define TASK_NONINTERACTIVE 64
+#define TASK_DEAD 128
#define __set_task_state(tsk, state_value) \
do { (tsk)->state = (state_value); } while (0)
--- 2.6.15-rc2/kernel/exit.c~1_CLEAN 2005-11-25 20:58:14.000000000 +0300
+++ 2.6.15-rc2/kernel/exit.c 2005-11-25 21:04:26.000000000 +0300
@@ -875,6 +875,7 @@ fastcall NORET_TYPE void do_exit(long co
preempt_disable();
BUG_ON(tsk->flags & PF_DEAD);
tsk->flags |= PF_DEAD;
+ tsk->state = TASK_DEAD;
schedule();
BUG();
--- 2.6.15-rc2/kernel/sched.c~1_CLEAN 2005-11-25 20:58:14.000000000 +0300
+++ 2.6.15-rc2/kernel/sched.c 2005-11-25 21:04:48.000000000 +0300
@@ -3000,9 +3000,6 @@ need_resched_nonpreemptible:
spin_lock_irq(&rq->lock);
- if (unlikely(prev->flags & PF_DEAD))
- prev->state = EXIT_DEAD;
-
switch_count = &prev->nivcsw;
if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
switch_count = &prev->nvcsw;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-11-25 15:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-25 16:18 [PATCH 1/2] v2 PF_DEAD: cleanup usage Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox