linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	darren@dvhart.com, fweisbec@gmail.com, oleg@redhat.com,
	sbw@mit.edu
Subject: Re: [PATCH tip/core/rcu 1/3] rcu: Optimize rcu_is_nocb_cpu() for RCU_NOCB_CPU_ALL
Date: Mon, 17 Feb 2014 15:33:31 -0800	[thread overview]
Message-ID: <20140217233331.GR4250@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140217215053.GE7941@thin>

On Mon, Feb 17, 2014 at 01:50:53PM -0800, Josh Triplett wrote:
> On Mon, Feb 17, 2014 at 01:40:25PM -0800, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > 
> > If CONFIG_RCU_NOCB_CPU_ALL=y, then rcu_is_nocb_cpu() will always
> > return true, however, the current version nevertheless checks
> > rcu_nocb_mask.  This commit therefore creates a static inline
> > implementation of rcu_is_nocb_cpu() that unconditionally returns
> > true when CONFIG_RCU_NOCB_CPU_ALL=y.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> One suggestion below.  With or without that change:
> Reviewed-by: Josh Triplett <josh@joshtriplett.org>

I like the change -- applied both it and your Reviewed-by.

							Thanx, Paul

> >  include/linux/rcupdate.h | 4 ++++
> >  kernel/rcu/tree_plugin.h | 2 ++
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > index 72bf3a01a4ee..92365b1fede4 100644
> > --- a/include/linux/rcupdate.h
> > +++ b/include/linux/rcupdate.h
> > @@ -1016,7 +1016,11 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
> >  	__kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
> >  
> >  #ifdef CONFIG_RCU_NOCB_CPU
> > +#ifdef CONFIG_RCU_NOCB_CPU_ALL
> > +static inline bool rcu_is_nocb_cpu(int cpu) { return true; }
> > +#else /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
> >  bool rcu_is_nocb_cpu(int cpu);
> > +#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU_ALL */
> >  #else
> >  static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
> >  #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
> 
> This seem clearer if written without the nesting:
> 
> #if defined(CONFIG_RCU_NOCB_CPU_ALL)
> static inline bool rcu_is_nocb_cpu(int cpu) { return true; }
> #elif defined(CONFIG_RCU_NOCB_CPU)
> bool rcu_is_nocb_cpu(int cpu);
> #else
> static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
> #endif
> 
> That clearly distinguishes the three cases: all, some, none.
> 
> > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> > index 6e2ef4b2b920..39a50b918bff 100644
> > --- a/kernel/rcu/tree_plugin.h
> > +++ b/kernel/rcu/tree_plugin.h
> > @@ -2101,6 +2101,7 @@ static void rcu_init_one_nocb(struct rcu_node *rnp)
> >  	init_waitqueue_head(&rnp->nocb_gp_wq[1]);
> >  }
> >  
> > +#ifndef CONFIG_RCU_NOCB_CPU_ALL
> >  /* Is the specified CPU a no-CPUs CPU? */
> >  bool rcu_is_nocb_cpu(int cpu)
> >  {
> > @@ -2108,6 +2109,7 @@ bool rcu_is_nocb_cpu(int cpu)
> >  		return cpumask_test_cpu(cpu, rcu_nocb_mask);
> >  	return false;
> >  }
> > +#endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */
> >  
> >  /*
> >   * Enqueue the specified string of rcu_head structures onto the specified
> > -- 
> > 1.8.1.5
> > 
> 


  reply	other threads:[~2014-02-17 23:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 21:40 [PATCH tip/core/rcu 0/3] Response-time changes for 3.15 Paul E. McKenney
2014-02-17 21:40 ` [PATCH tip/core/rcu 1/3] rcu: Optimize rcu_is_nocb_cpu() for RCU_NOCB_CPU_ALL Paul E. McKenney
2014-02-17 21:40   ` [PATCH tip/core/rcu 2/3] rcu: Optimize rcu_needs_cpu() " Paul E. McKenney
2014-02-17 21:53     ` Josh Triplett
2014-02-17 21:40   ` [PATCH tip/core/rcu 3/3] rcu: Optimize RCU_FAST_NO_HZ " Paul E. McKenney
2014-02-17 21:54     ` Josh Triplett
2014-02-17 21:50   ` [PATCH tip/core/rcu 1/3] rcu: Optimize rcu_is_nocb_cpu() " Josh Triplett
2014-02-17 23:33     ` Paul E. McKenney [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-11-18 22:02 [PATCH RFC tip/core/rcu 0/3] RT latency optimizations Paul E. McKenney
2013-11-18 22:02 ` [PATCH tip/core/rcu 1/3] rcu: Optimize rcu_is_nocb_cpu() for RCU_NOCB_CPU_ALL 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=20140217233331.GR4250@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=darren@dvhart.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=niv@us.ibm.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sbw@mit.edu \
    --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;
as well as URLs for NNTP newsgroup(s).