Use this to simplify 'finish_task_switch', but perhaps more
importantly we can use this to track down why some processes
seem to sometimes not die properly even after having been
marked as ZOMBIE. The "task->state" flags are too fluid to
allow that well.
/* Not implemented yet, only for 486*/
#define PF_STARTING 0x00000002 /* being created */
#define PF_EXITING 0x00000004 /* getting shut down */
+#define PF_DEAD 0x00000008 /* Dead */
#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
#define PF_DUMPCORE 0x00000200 /* dumped core */
}
tsk->state = TASK_ZOMBIE;
+ tsk->flags |= PF_DEAD;
/*
* In the preemption case it must be impossible for the task
* to get runnable again, so use "_raw_" unlock to keep
{
runqueue_t *rq = this_rq();
struct mm_struct *mm = rq->prev_mm;
- int drop_task_ref;
+ unsigned long prev_task_flags;
rq->prev_mm = NULL;
* be dropped twice.
* Manfred Spraul <manfred@colorfullife.com>
*/
- drop_task_ref = 0;
- if (unlikely(prev->state & (TASK_DEAD | TASK_ZOMBIE)))
- drop_task_ref = 1;
-
+ prev_task_flags = prev->flags;
finish_arch_switch(rq, prev);
if (mm)
mmdrop(mm);
- if (drop_task_ref)
+ if (unlikely(prev_task_flags & PF_DEAD))
put_task_struct(prev);
}