From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751874AbdG1MSY (ORCPT ); Fri, 28 Jul 2017 08:18:24 -0400 Received: from smtprelay0150.hostedemail.com ([216.40.44.150]:58005 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751628AbdG1MSX (ORCPT ); Fri, 28 Jul 2017 08:18:23 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1543:1593:1594:1605:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2907:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3873:3874:4250:4321:4385:5007:6261:6742:7875:7901:7903:8660:8957:9010:9040:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12296:12438:12555:12740:12760:12895:13141:13148:13230:13255:13439:14096:14097:14181:14659:14721:21080:21324:21433:21627:30006:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: blood45_2bc6a0a5afd19 X-Filterd-Recvd-Size: 4444 Date: Fri, 28 Jul 2017 08:18:18 -0400 From: Steven Rostedt To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com Subject: Re: [PATCH tip/core/rcu 07/15] rcu: Add event tracing to ->gp_tasks update at GP start Message-ID: <20170728081818.357a3612@vmware.local.home> In-Reply-To: <20170728032232.GA3730@linux.vnet.ibm.com> References: <20170724214425.GA9665@linux.vnet.ibm.com> <1500932684-10469-7-git-send-email-paulmck@linux.vnet.ibm.com> <20170727213810.2a1c03d1@vmware.local.home> <20170728032232.GA3730@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; 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 Thu, 27 Jul 2017 20:22:32 -0700 "Paul E. McKenney" wrote: > On Thu, Jul 27, 2017 at 09:38:10PM -0400, Steven Rostedt wrote: > > On Mon, 24 Jul 2017 14:44:36 -0700 > > "Paul E. McKenney" wrote: > > > > > There is currently event tracing to track when a task is preempted > > > within a preemptible RCU read-side critical section, and also when that > > > task subsequently reaches its outermost rcu_read_unlock(), but none > > > indicating when a new grace period starts when that grace period must > > > wait on pre-existing readers that have been been preempted at least once > > > since the beginning of their current RCU read-side critical sections. > > > > > > This commit therefore adds an event trace at grace-period start in > > > the case where there are such readers. Note that only the first > > > reader in the list is traced. > > > > > > Signed-off-by: Paul E. McKenney > > > --- > > > kernel/rcu/tree_plugin.h | 9 ++++++++- > > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > > > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h > > > index 14ba496a13cd..3e3f92e981a1 100644 > > > --- a/kernel/rcu/tree_plugin.h > > > +++ b/kernel/rcu/tree_plugin.h > > > @@ -636,10 +636,17 @@ static int rcu_print_task_exp_stall(struct rcu_node *rnp) > > > */ > > > static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp) > > > { > > > + struct task_struct *t; > > > + > > > RCU_LOCKDEP_WARN(preemptible(), "rcu_preempt_check_blocked_tasks() invoked with preemption enabled!!!\n"); > > > WARN_ON_ONCE(rcu_preempt_blocked_readers_cgp(rnp)); > > > - if (rcu_preempt_has_tasks(rnp)) > > > + if (rcu_preempt_has_tasks(rnp)) { > > > > The only function of this if block is to fill the content of the > > trace event, correct? > > > > What about doing: > > > > if (trace_rcu_unlock_preempted_task_enabled() && > > rcu_preempt_has_tasks(rnp)) { > > > > instead? The trace_rcu_unlock_preempted_task_enabled() is a static > > branch (aka jump_label), which would make the above a constant branch > > when tracing is not enabled, and would keep this from adding any extra > > overhead. > > > > -- Steve > > > > > rnp->gp_tasks = rnp->blkd_tasks.next; > > The trace_rcu_unlock_preempted_task_enabled() call is a new one on me, > thank you! > > Unfortunately, the above assignment to rnp->gp_tasks is required even > if tracing is disabled. The reason is that the newly started grace > period needs to wait on all tasks that have been preempted within their > current RCU read-side critical section, and rnp->gp_tasks records the > point in the rnp->blkd_tasks list beyond which all preempted tasks block > this new grace period. > > If this assignment is omitted, we get too-short grace periods, and the > tasks on this list might still be holding references to stuff that gets > freed at the end of this new grace period. > > I applied your two acks, thank you! > And with you answer about the block not just being for tracing, you can add my acked-by here too ;-) -- Steve