From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752971AbcLJNg7 (ORCPT ); Sat, 10 Dec 2016 08:36:59 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36218 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbcLJNg6 (ORCPT ); Sat, 10 Dec 2016 08:36:58 -0500 Date: Sat, 10 Dec 2016 21:36:29 +0800 From: Boqun Feng To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan Subject: Re: [RFC 0/5] rcu: Introduce leaf_node_for_each_mask_possible_cpu() and its friend Message-ID: <20161210133629.GB9728@tardis.cn.ibm.com> References: <20161209084828.11827-1-boqun.feng@gmail.com> <20161209234945.GM3924@linux.vnet.ibm.com> <20161210004538.GA9728@tardis.cn.ibm.com> <20161210042805.GN3924@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NMuMz9nt05w80d4+" Content-Disposition: inline In-Reply-To: <20161210042805.GN3924@linux.vnet.ibm.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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, > > > >=20 > > > > While reading the discussion at: > > > >=20 > > > > https://marc.info/?l=3Dlinux-kernel&m=3D148044253400769 > > >=20 > > > This discussion was for stalls specifically, rather than for routine > > > scans of the bitmasks. > > >=20 > > > But it does look to save some code, so worth looking into. > > >=20 > > > > I figured we might use this fact to save some extra checks in RCU c= ore code, > > > > currently we iterate over all the possible CPUs on a leaf node, che= ck 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 corr= esponding > > > > part of cpu_possible_mask, we'd better iterate over all bits in a m= ask and > > > > check whether the corresponding CPU is possible or not. > > > >=20 > > > > So I made this RFC, I did a simple build/boot/rcutorture test on my= box with > > > > SMP=3D4, nothing bad happens. Currently I'm waiting for the 0day an= d trying to > > > > test this one a bigger system, in the meanwhile, looking forwards t= o any > > > > comment and suggestion. > > > >=20 > > > > So thoughts? > > >=20 > > > By analogy with for_each_cpu() and for_each_possible_cpu(), the name > > > should instead be for_each_leaf_node_cpu(), the tradition of excessiv= ely > > > long names in RCU notwithstanding. ;-) > > >=20 > >=20 > > Make sense ;-) > >=20 > > 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 ;-) >=20 > C'mon, Boqun! The for_each_leaf_node_cpu() is not only consistent > with the for_each_cpu() family, it is shorter! ;-) >=20 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. 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 ;-) Regards, Boqun > Thanx, Paul >=20 > > Will modify that in next version. > >=20 > > Regards, > > Boqun > >=20 > > > Thanx, Paul > > >=20 >=20 >=20 --NMuMz9nt05w80d4+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAABCAAGBQJYTATZAAoJEEl56MO1B/q4k7wH/j3+wNiDDBp2ELqUhcgu3xv0 FFSm1Jaq6GdBRPZbd92WcAnIVAqb5tUAownLao4GxjO8/3tb5wCJYk/BWDY4s5on h9KX1HuYPhxkn6ldsVlrAcTv2TQwSTSE0kQDrgUzyF1LYHiZdfg8gZ+0MiTfDXQ1 O9JnZGiy1zugRlHw0HFSdI4c2QJYBLPr2ev65ZpayV/aqg2VIGB1WG6hh65QbVWw kqFq2h0uo0T5COCCvpgEVcxOmXO/mqdBkRcE9cy4/iCHKloRgZc5m/5EXiq2015P 885B/M4EkVXgMsS8XICLTrCr2FyA/6C/NInCZRtbJT9Dz1DOPQ8BWxH94X6YJ9w= =j3at -----END PGP SIGNATURE----- --NMuMz9nt05w80d4+--