linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>
Subject: Re: [RFC 0/5] rcu: Introduce leaf_node_for_each_mask_possible_cpu() and its friend
Date: Sun, 11 Dec 2016 08:06:04 +0800	[thread overview]
Message-ID: <20161211000604.GC9728@tardis.cn.ibm.com> (raw)
In-Reply-To: <20161210173854.GR3924@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3817 bytes --]

On Sat, Dec 10, 2016 at 09:38:54AM -0800, Paul E. McKenney wrote:
> On Sat, Dec 10, 2016 at 09:36:29PM +0800, Boqun Feng wrote:
> > On Fri, Dec 09, 2016 at 08:28:05PM -0800, Paul E. McKenney wrote:
> > > On Sat, Dec 10, 2016 at 08:45:38AM +0800, Boqun Feng wrote:
> > > > On Fri, Dec 09, 2016 at 03:49:45PM -0800, Paul E. McKenney wrote:
> > > > > On Fri, Dec 09, 2016 at 04:48:22PM +0800, Boqun Feng wrote:
> > > > > > Hi Paul,
> > > > > > 
> > > > > > While reading the discussion at:
> > > > > > 
> > > > > > https://marc.info/?l=linux-kernel&m=148044253400769
> > > > > 
> > > > > This discussion was for stalls specifically, rather than for routine
> > > > > scans of the bitmasks.
> > > > > 
> > > > > But it does look to save some code, so worth looking into.
> > > > > 
> > > > > > I figured we might use this fact to save some extra checks in RCU core code,
> > > > > > currently we iterate over all the possible CPUs on a leaf node, check whether
> > > > > > they were masked in a certain mask and do something. However, given the fact
> > > > > > that the masks on a leaf node should always be sparse than the corresponding
> > > > > > part of cpu_possible_mask, we'd better iterate over all bits in a mask and
> > > > > > check whether the corresponding CPU is possible or not.
> > > > > > 
> > > > > > So I made this RFC, I did a simple build/boot/rcutorture test on my box with
> > > > > > SMP=4, nothing bad happens. Currently I'm waiting for the 0day and trying to
> > > > > > test this one a bigger system, in the meanwhile, looking forwards to any
> > > > > > comment and suggestion.
> > > > > > 
> > > > > > So thoughts?
> > > > > 
> > > > > By analogy with for_each_cpu() and for_each_possible_cpu(), the name
> > > > > should instead be for_each_leaf_node_cpu(), the tradition of excessively
> > > > > long names in RCU notwithstanding.  ;-)
> > > > > 
> > > > 
> > > > Make sense ;-)
> > > > 
> > > > I think it's more appropriate to call it for_each_leaf_node_mask_cpu(),
> > > > because we don't iterate all cpus of a leaf node. The word "possible"
> > > > could be dropped because obviously we won't iterate over "impossible"
> > > > cpus in a leaf node ;-)
> > > 
> > > C'mon, Boqun!  The for_each_leaf_node_cpu() is not only consistent
> > > with the for_each_cpu() family, it is shorter!  ;-)
> > 
> > Sure ;-) But for_each_leaf_node_cpu() seems like an operation that
> > iterates over _all_ cpus in a leaf node, but I actually implement it as
> > an operation that iterates only the _masked_ cpus. So I feel like word
> > "mask" better be added in the name.
> 
> Although that is a fair point, the same can be said of for_each_cpu().
> Which people seem to be able to use without undue pain.
> 
> > If we call it for_each_leaf_node_cpu(rnp, mask,...), we will rely on the
> > hope that readers could figure it out what the primitive actually does
> > by the indication of the parameter @mask.
> > 
> > I like shorter names too, but not sure whether putting "mask" in the
> > name is better. After all, naming is one of the most difficult
> > challenges in programming ;-)
> 
> The two most difficult challenges in programming are the last two hard
> things that the person speaking worked on.  ;-)
> 

;-)

> Consistency is more important than the stand-alone understanding of
> this particular name.  You can always add a comment pointing out that
> it follows for_each_cpu().
> 

Fair enough. Let us name it for_each_leaf_node_cpu() ;-)

Regards,
Boqun

> 							Thanx, Paul
> 
> > Regards,
> > Boqun
> > 
> > > 							Thanx, Paul
> > > 
> > > > Will modify that in next version.
> > > > 
> > > > Regards,
> > > > Boqun
> > > > 
> > > > > 							Thanx, Paul
> > > > > 
> > > 
> > > 
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

      reply	other threads:[~2016-12-11  0:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09  8:48 [RFC 0/5] rcu: Introduce leaf_node_for_each_mask_possible_cpu() and its friend Boqun Feng
2016-12-09  8:48 ` [RFC 1/5] rcu: Introduce primitives to iterate mask bits in an RCU leaf node Boqun Feng
2016-12-09  8:48 ` [RFC 2/5] rcu: Use leaf_node_for_each_mask_possible_cpu() in RCU stall checking Boqun Feng
2016-12-09  8:48 ` [RFC 3/5] rcu: Use leaf_node_for_each_mask_possible_cpu() for ->expmask iteration Boqun Feng
2016-12-09  8:48 ` [RFC 4/5] rcu: Use leaf_node_for_each_mask_possible_cpu() in force_qs_rnp() Boqun Feng
2016-12-09  8:48 ` [RFC 5/5] rcu: Use leaf_node_for_each_mask_*() for leaf node online CPU iteration Boqun Feng
2016-12-09 23:49 ` [RFC 0/5] rcu: Introduce leaf_node_for_each_mask_possible_cpu() and its friend Paul E. McKenney
2016-12-10  0:45   ` Boqun Feng
2016-12-10  4:28     ` Paul E. McKenney
2016-12-10 13:36       ` Boqun Feng
2016-12-10 17:38         ` Paul E. McKenney
2016-12-11  0:06           ` Boqun Feng [this message]

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=20161211000604.GC9728@tardis.cn.ibm.com \
    --to=boqun.feng@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.vnet.ibm.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).