From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Laight <David.Laight@ACULAB.COM>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Ingo Molnar <mingo@kernel.org>, Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] sched: Check TASK_DEAD rather than EXIT_DEAD in schedule_debug()
Date: Wed, 13 Nov 2013 16:45:38 +0100 [thread overview]
Message-ID: <20131113154538.GB15810@redhat.com> (raw)
In-Reply-To: <20131113154516.GA15810@redhat.com>
schedule_debug() ignores in_atomic() if prev->exit_state != 0.
This is not what we want, ->exit_state is set by exit_notify()
but we should complain until the task does the last schedule()
in TASK_DEAD.
See also 7407251a0e2e "PF_DEAD cleanup", I think this ancient
commit explains why schedule() had to rely on ->exit_state,
until that commit exit_notify() disabled preemption and set
PF_DEAD which was used to detect the exiting task.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/sched/core.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5ac63c9..7184357 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2287,10 +2287,10 @@ static inline void schedule_debug(struct task_struct *prev)
{
/*
* Test if we are atomic. Since do_exit() needs to call into
- * schedule() atomically, we ignore that path for now.
- * Otherwise, whine if we are scheduling when we should not be.
+ * schedule() atomically, we ignore that path. Otherwise whine
+ * if we are scheduling when we should not.
*/
- if (unlikely(in_atomic_preempt_off() && !prev->exit_state))
+ if (unlikely(in_atomic_preempt_off() && prev->state != TASK_DEAD))
__schedule_bug(prev);
rcu_sleep_check();
--
1.5.5.1
next prev parent reply other threads:[~2013-11-13 15:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 14:35 [PATCH 0/3] state/exit_state cleanups (Was: Remove unused variable ret from sync_thread_master()) Oleg Nesterov
2013-11-13 14:36 ` [PATCH 1/3] proc: cleanup/simplify get_task_state/task_state_array Oleg Nesterov
2013-11-13 14:36 ` [PATCH 2/3] fork: no need to initialize child->exit_state Oleg Nesterov
2013-11-27 14:10 ` [tip:sched/core] tasks/fork: Remove unnecessary child->exit_state tip-bot for Oleg Nesterov
2013-11-13 14:36 ` [PATCH 3/3] exit_state: kill task_is_dead() Oleg Nesterov
2013-11-27 14:10 ` [tip:sched/core] tasks/exit: Remove unused task_is_dead() method tip-bot for Oleg Nesterov
2013-11-13 14:48 ` [PATCH 0/3] state/exit_state cleanups (Was: Remove unused variable ret from sync_thread_master()) Peter Zijlstra
2013-11-13 14:50 ` Peter Zijlstra
2013-11-13 15:45 ` [PATCH 0/1] sched: Check TASK_DEAD rather than EXIT_DEAD in schedule_debug() Oleg Nesterov
2013-11-13 15:45 ` Oleg Nesterov [this message]
2013-11-27 14:10 ` [tip:sched/core] " tip-bot for Oleg Nesterov
2013-11-13 15:58 ` [PATCH 0/1] " Peter Zijlstra
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=20131113154538.GB15810@redhat.com \
--to=oleg@redhat.com \
--cc=David.Laight@ACULAB.COM \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tj@kernel.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