mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>, Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH 1/2] PF_DEAD: cleanup usage
Date: Sun, 27 Nov 2005 13:18:35 +0100	[thread overview]
Message-ID: <20051127121835.GB22229@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.64.0511261023500.13959@g5.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

  reply	other threads:[~2005-11-27 12:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-24 16:02 Oleg Nesterov
2005-11-25  5:12 ` Ingo Molnar
2005-11-25 18:01   ` Linus Torvalds
2005-11-26 10:46     ` Oleg Nesterov
2005-11-26 17:55       ` Linus Torvalds
2005-11-26 19:21         ` Oleg Nesterov
2005-11-26 18:47           ` Linus Torvalds
2005-11-27 12:18             ` Ingo Molnar [this message]
2005-11-27 13:02             ` Oleg Nesterov
2005-11-27 11:55     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051127121835.GB22229@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®