From: Oleg Nesterov <oleg@tv-sign.ru>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH 1/2] PF_DEAD: cleanup usage
Date: Thu, 24 Nov 2005 19:02:07 +0300 [thread overview]
Message-ID: <4385E3FF.C99DBCF5@tv-sign.ru> (raw)
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;
next reply other threads:[~2005-11-24 14:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-24 16:02 Oleg Nesterov [this message]
2005-11-25 5:12 ` [PATCH 1/2] PF_DEAD: cleanup usage 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
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=4385E3FF.C99DBCF5@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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