mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
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, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH tip/core/rcu 06/10] trace: Eliminate cond_resched_rcu_qs() in favor of cond_resched()
Date: Thu, 1 Mar 2018 12:48:58 -0800	[thread overview]
Message-ID: <20180301204858.GH3777@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180301000404.64828a0e@vmware.local.home>

On Thu, Mar 01, 2018 at 12:04:04AM -0500, Steven Rostedt wrote:
> On Wed, 28 Feb 2018 17:21:44 -0800
> "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
> 
> > > Perhaps, still think this is a special case. That said, perhaps
> > > cond_resched isn't done in critical locations as it's a place that is
> > > explicitly stating that it's OK to schedule.  
> > 
> > Building on your second sentence, when you are running a non-production
> > stress test, adding an extra function call and conditional branch to
> > cond_resched() should not be a problem.
> > 
> > So how about the (still untested) patch below?
> > 
> > 							Thanx, Paul
> > 
> > ------------------------------------------------------------------------
> > 
> > commit e9a6ea9fc2542459f9a63cf2b3a0264d09fbc266
> > Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Date:   Sun Feb 25 10:40:44 2018 -0800
> > 
> >     EXP sched: Make non-production PREEMPT cond_resched() help Tasks RCU
> >     
> >     In CONFIG_PREEMPT=y kernels, cond_resched() is a complete no-op, and
> >     thus cannot help advance Tasks-RCU grace periods.  However, such grace
> >     periods are only an issue in non-production benchmarking runs of the
> >     Linux kernel.  This commit therefore makes cond_resched() invoke
> >     rcu_note_voluntary_context_switch() for kernels implementing Tasks RCU
> >     even in CONFIG_PREEMPT=y kernels.
> >     
> >     Reported-by: Steven Rostedt <rostedt@goodmis.org>
> >     Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 
> > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > index b161ef8a902e..970dadefb86f 100644
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -1589,6 +1589,12 @@ static inline int test_tsk_need_resched(struct task_struct *tsk)
> >   */
> >  #ifndef CONFIG_PREEMPT
> >  extern int _cond_resched(void);
> > +#elif defined(CONFIG_TRACEPOINT_BENCHMARK)
> > +static inline int _cond_resched(void)
> > +{
> > +	rcu_note_voluntary_context_switch(current);
> 
> The thing I hate about this is that it is invasive to code outside of
> the tracepoint benchmark. Why do the rcu_note_voluntary_context_switch
> here and not in the tracepoint code? Seems odd to have it called
> everywhere in the kernel when it is only needed by the benchmark
> tracepoint code.

Understood, and I am not completely devoid of sympathy for that view.
My problem with adding rcu_note_voluntary_context_switch() is that it
is a pretty deep detail of RCU.

Hmmm...  I wasn't happy with your original use of cond_resched_rcu_qs()
because it is now a rather strange thing.  However, this discussion has
helped me to understand that its real distinction over cond_resched()
as things stand now is that is provides a quiescent state for Tasks RCU.

So how about I rename cond_resched_rcu_qs() to cond_resched_tasks_rcu_qs(),
which at least gives a hint as to where it needs to be used?

Would that work for you?

							Thanx, Paul

> -- Steve
> 
> 
> 
> > +	return 0;
> > +}
> >  #else
> >  static inline int _cond_resched(void) { return 0; }
> >  #endif
> 

  reply	other threads:[~2018-03-01 20:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 19:21 [PATCH tip/core/rcu 0/10] Don not IPI offline CPUs, de-emphasize cond_resched_rcu_qs() Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 01/10] sched: Stop resched_cpu() from sending IPIs to offline CPUs Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 02/10] sched: Stop switched_to_rt() " Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 03/10] netfilter: Eliminate cond_resched_rcu_qs() in favor of cond_resched() Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 04/10] mm: " Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 05/10] workqueue: " Paul E. McKenney
2017-12-02  1:06   ` Lai Jiangshan
2017-12-04 18:28     ` Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 06/10] trace: " Paul E. McKenney
2018-02-24 20:12   ` Steven Rostedt
2018-02-25 17:49     ` Paul E. McKenney
2018-02-25 18:17       ` Paul E. McKenney
2018-02-25 18:39         ` Paul E. McKenney
2018-02-27  2:29           ` Steven Rostedt
2018-02-27 15:36             ` Paul E. McKenney
2018-02-28 23:12               ` Steven Rostedt
2018-03-01  1:21                 ` Paul E. McKenney
2018-03-01  5:04                   ` Steven Rostedt
2018-03-01 20:48                     ` Paul E. McKenney [this message]
2018-03-02 20:06                       ` Steven Rostedt
2018-03-03  0:54                         ` Paul E. McKenney
2018-02-26  4:57         ` Steven Rostedt
2018-02-26  5:47           ` Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 07/10] softirq: " Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 08/10] fs: " Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 09/10] doc: " Paul E. McKenney
2017-12-01 19:21 ` [PATCH tip/core/rcu 10/10] rcu: Account for rcu_all_qs() in cond_resched() Paul E. McKenney
2017-12-02  8:56   ` Peter Zijlstra
2017-12-02 12:22     ` Paul E. McKenney
2017-12-02 13:55       ` Peter Zijlstra
2018-02-24 20:18       ` Steven Rostedt
2018-02-25 17:52         ` Paul E. McKenney

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=20180301204858.GH3777@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome