Re: [PATCH 1/2] PF_DEAD: cleanup usage

From: Ingo Molnar (mingo_at_elte.hu)
Date: 11/27/05

  • Next message: Ingo Molnar: "Re: [PATCH] Make RCU task_struct safe for oprofile"
    Date:	Sun, 27 Nov 2005 13:18:35 +0100
    To: Linus Torvalds <torvalds@osdl.org>
    
    

    * Linus Torvalds <torvalds@osdl.org> wrote:

    > Well, in all fairness, it's entirely possible (nay, likely) that
    > PF_DEAD just isn't relevant the way it used to be.

    yes, that's the case. I do believe we should go with Oleg's original
    patches.

    > Looking at the history, the immediate reason for PF_DEAD was (I think)
    > that we had a race where we would first mark the task as a ZOMBIE, and
    > then if it was self-reaping, we'd mark it dead in release_task(). But
    > we dropped the tasklist_lock in between, which meant that the real
    > parent could come in and reap it just before it reaped itself, and all
    > hell would break lose.

    yeah. Another problem was if we accidentally scheduled somewhere after
    the task was marked TASK_DEAD. (That used to be caught by another
    PF_DEAD check before the final schedule()).

    all this stuff got changed as part of the PREEMPT_VOLUNTARY changes, and
    now we exit in a much more robust way.

    > HOWEVER. I just noticed something strange. EXIT_DEAD should be in
    > "task->exit_state", not in "task->state". So there's something strange
    > going on in that neck of the woods _anyway_. That whole
    >
    > ...
    > if (unlikely(prev->flags & PF_DEAD))
    > prev->state = EXIT_DEAD;
    > ...
    >
    > in kernel/sched.c seems totally bogus.

    no, it's not bogus. PF_DEAD is basically just a fancy, persistent flag
    for "mark the task state as EXIT_DEAD atomically before the final
    schedule". The TASK_DEAD flag is still necessary so that we dont stay on
    the runqueue. [we could use TASK_UNINTERRUPTIBLE - it should just not be
    TASK_RUNNING or TASK_INTERRUPTIBLE.]

    in any case, i agree with Oleg's patches: with the current code it's
    unnecessary to signal towards schedule() to turn the PF_DEAD flag into
    EXIT_DEAD - we can do it right where we set PF_DEAD: immediately before
    calling the final schedule(). PF_DEAD is a relic from the days when the
    exit path was structured differently.

            Ingo
    -
    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/


  • Next message: Ingo Molnar: "Re: [PATCH] Make RCU task_struct safe for oprofile"

    Relevant Pages

    • Re: dynamic-hz
      ... >> probably should just call schedule() directly. ... I won't make any such changes in my next next set of patches. ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)
    • use of PREEMPT_ACTIVE ?
      ... the PREEMPT_ACTIVE flag set by preempt_scheduleor during return of ... And it's tested in schedule() to ... However the PREEMPT_ACTIVE flag can prevent it. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] do_wait fix for 2.6.10-rc1
      ... > All of your patches address the TASK_STOPPED case, ... We use "flag" for two ... "we have children that will wake us up" bit is set. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linux 2.6.12-rc3
      ... > will list my patches, ... We could add a flag to rev-tree to always follow only the first parent; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: tasklet_kill will always hang for recursive tasklets on a UP
      ... > how recursive tasklets (tasklets that schedule themselves from within ... You can always introduce a flag that tells the tasklet if it should ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)

    Loading