From: Peter Zijlstra <peterz@infradead.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] sched: fix the PREEMPT_ACTIVE check in __trace_sched_switch_state()
Date: Fri, 10 Oct 2014 11:54:52 +0200 [thread overview]
Message-ID: <20141010095452.GH10832@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20141007195108.GB28002@redhat.com>
On Tue, Oct 07, 2014 at 09:51:08PM +0200, Oleg Nesterov wrote:
> task_preempt_count() has nothing to do with the actual preempt counter,
> thread_info->saved_preempt_count is only valid right after switch_to().
>
> __trace_sched_switch_state() can use preempt_count(), prev is still the
> current task when trace_sched_switch() is called.
This is true, but the paranoid in me would like a BUG_ON(p != current)
right along with that to make sure we don't accidentally change this.
But yes, its good to get rid of task_preempt_count(), its horrible.
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> ---
> include/trace/events/sched.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index 0a68d5a..a7d67bc 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct task_struct *p)
> /*
> * For all intents and purposes a preempted task is a running task.
> */
> - if (task_preempt_count(p) & PREEMPT_ACTIVE)
> + if (preempt_count() & PREEMPT_ACTIVE)
> state = TASK_RUNNING | TASK_STATE_MAX;
> #endif
>
> --
> 1.5.5.1
>
>
next prev parent reply other threads:[~2014-10-10 9:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 19:50 [PATCH 0/1] sched: fix the PREEMPT_ACTIVE check in __trace_sched_switch_state() Oleg Nesterov
2014-10-07 19:51 ` [PATCH 1/1] " Oleg Nesterov
2014-10-10 9:54 ` Peter Zijlstra [this message]
2014-10-10 9:56 ` Peter Zijlstra
2014-10-28 11:05 ` [tip:sched/core] sched: Fix " tip-bot for Oleg Nesterov
2014-10-08 8:00 ` [PATCH 0/1] sched: fix " Peter Zijlstra
2014-10-08 18:33 ` [PATCH 0/2] (Was: sched: fix the PREEMPT_ACTIVE check in __trace_sched_switch_state()) Oleg Nesterov
2014-10-08 18:33 ` [PATCH 1/2] sched: schedule_tail() should disable preemption Oleg Nesterov
2014-10-08 19:36 ` [PATCH v2 " Oleg Nesterov
2014-10-08 21:37 ` Kirill Tkhai
2014-10-09 14:57 ` Oleg Nesterov
2014-10-09 15:17 ` Peter Zijlstra
2014-10-09 16:57 ` Oleg Nesterov
2014-10-09 17:28 ` Peter Zijlstra
2014-10-09 17:32 ` Peter Zijlstra
2014-10-09 17:55 ` Oleg Nesterov
2014-10-28 11:06 ` [tip:sched/core] sched: Fix schedule_tail() to " tip-bot for Oleg Nesterov
2014-10-08 18:33 ` [PATCH 2/2] sched: kill task_preempt_count() Oleg Nesterov
2014-10-28 11:06 ` [tip:sched/core] sched: Kill task_preempt_count() tip-bot for Oleg Nesterov
2014-10-09 19:32 ` [PATCH 0/1] sched: make finish_task_switch() return struct rq * Oleg Nesterov
2014-10-09 19:32 ` [PATCH 1/1] " Oleg Nesterov
2014-10-10 10:06 ` Peter Zijlstra
2014-10-10 17:06 ` Oleg Nesterov
2014-10-10 20:32 ` Peter Zijlstra
2014-10-14 17:57 ` Oleg Nesterov
2014-10-28 11:06 ` [tip:sched/core] sched: Make finish_task_switch() return ' struct rq *' tip-bot for Oleg Nesterov
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=20141010095452.GH10832@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).