lkml.org 
[lkml]   [2005]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 1/2] PF_DEAD: cleanup usage
    schedule() checks PF_DEAD on every context switch, and sets ->state = EXIT_DEAD
    to ensure that exited task will be deactivated.

    I think it is better to set EXIT_DEAD in do_exit(), along with PF_DEAD flag.

    It is safe to do without task_rq() locking, because concurrent try_to_wake_up()
    can't change task's ->state: the 'state' argument of try_to_wake_up() can't have
    EXIT_DEAD bit. And in case when try_to_wake_up() sees stale value of ->state ==
    TASK_RUNNING it will do nothing.

    Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

    --- 2.6.15-rc2/kernel/exit.c~4_DEAD 2005-11-23 19:33:27.000000000 +0300
    +++ 2.6.15-rc2/kernel/exit.c 2005-11-24 19:14:29.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 = EXIT_DEAD;

    schedule();
    BUG();
    --- 2.6.15-rc2/kernel/sched.c~4_DEAD 2005-11-22 19:35:52.000000000 +0300
    +++ 2.6.15-rc2/kernel/sched.c 2005-11-24 19:13:34.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;
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-11-24 15:51    [W:4.157 / U:0.528 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site