From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934854AbbI2Pir (ORCPT ); Tue, 29 Sep 2015 11:38:47 -0400 Received: from smtprelay0137.hostedemail.com ([216.40.44.137]:49138 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934908AbbI2PiQ (ORCPT ); Tue, 29 Sep 2015 11:38:16 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::,RULES_HIT:41:69:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2693:2892:3138:3139:3140:3141:3142:3354:3622:3865:3867:3868:3871:3872:3873:3874:4605:5007:6261:7875:7886:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12114:12296:12438:12517:12519:12740:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: mind80_da4d94fb2d1d X-Filterd-Recvd-Size: 3225 Date: Tue, 29 Sep 2015 11:38:12 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, fweisbec@gmail.com, oleg@redhat.com, umgwanakikbuti@gmail.com, tglx@linutronix.de Subject: Re: [RFC][PATCH 06/11] sched: Fix trace_sched_switch() Message-ID: <20150929113812.0bc594d0@gandalf.local.home> In-Reply-To: <20150929093520.240883073@infradead.org> References: <20150929092825.540553633@infradead.org> <20150929093520.240883073@infradead.org> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Sep 2015 11:28:31 +0200 Peter Zijlstra wrote: > __trace_sched_switch_state() is the last remaining PREEMPT_ACTIVE > user, move trace_sched_switch() from prepare_task_switch() to > __schedule() and propagate the @preempt argument. > > Signed-off-by: Peter Zijlstra (Intel) > --- > include/trace/events/sched.h | 22 +++++++++------------- > kernel/sched/core.c | 2 +- > kernel/trace/ftrace.c | 2 +- > kernel/trace/trace_sched_switch.c | 3 ++- > kernel/trace/trace_sched_wakeup.c | 2 +- > 5 files changed, 14 insertions(+), 17 deletions(-) > > --- a/include/trace/events/sched.h > +++ b/include/trace/events/sched.h > @@ -104,22 +104,17 @@ DEFINE_EVENT(sched_wakeup_template, sche > TP_ARGS(p)); > > #ifdef CREATE_TRACE_POINTS > -static inline long __trace_sched_switch_state(struct task_struct *p) > +static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p) > { > - long state = p->state; > - > -#ifdef CONFIG_PREEMPT > #ifdef CONFIG_SCHED_DEBUG > BUG_ON(p != current); > #endif /* CONFIG_SCHED_DEBUG */ > + > /* > - * For all intents and purposes a preempted task is a running task. > + * Preemption ignores task state, therefore preempted tasks are always > + * RUNNING (we will not have dequeued if state != RUNNING). > */ > - if (preempt_count() & PREEMPT_ACTIVE) > - state = TASK_RUNNING | TASK_STATE_MAX; > -#endif /* CONFIG_PREEMPT */ > - > - return state; > + return preempt ? TASK_RUNNING | TASK_STATE_MAX : p->state; > } Hmm, this original change screwed up kernelshark, as it used the state to determine if something was preempted or not. Because now you always show a task as running, it can't do that anymore. I think I bitched about this before. What about nuking the above and just export to the sched_switch tracepoint the fact that it was preempted. We now have that information passed to it. As everything should be using the parsing files, it should not break any tools to export it. As for this patch and with the current state, I see nothing wrong with it. Reviewed-by: Steven Rostedt -- Steve