From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752885AbcLKAGd (ORCPT ); Sat, 10 Dec 2016 19:06:33 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34908 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751302AbcLKAGc (ORCPT ); Sat, 10 Dec 2016 19:06:32 -0500 Date: Sun, 11 Dec 2016 08:06:04 +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: <20161211000604.GC9728@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> <20161210133629.GB9728@tardis.cn.ibm.com> <20161210173854.GR3924@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lMM8JwqTlfDpEaS6" Content-Disposition: inline In-Reply-To: <20161210173854.GR3924@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 --lMM8JwqTlfDpEaS6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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, > > > > > >=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 rout= ine > > > > > 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 R= CU 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, g= iven 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. > > > > > >=20 > > > > > > So I made this RFC, I did a simple build/boot/rcutorture test o= n my box with > > > > > > SMP=3D4, nothing bad happens. Currently I'm waiting for the 0da= y and trying to > > > > > > test this one a bigger system, in the meanwhile, looking forwar= ds to any > > > > > > comment and suggestion. > > > > > >=20 > > > > > > So thoughts? > > > > >=20 > > > > > By analogy with for_each_cpu() and for_each_possible_cpu(), the n= ame > > > > > should instead be for_each_leaf_node_cpu(), the tradition of exce= ssively > > > > > long names in RCU notwithstanding. ;-) > > > > >=20 > > > >=20 > > > > Make sense ;-) > > > >=20 > > > > I think it's more appropriate to call it for_each_leaf_node_mask_cp= u(), > > > > because we don't iterate all cpus of a leaf node. The word "possibl= e" > > > > could be dropped because obviously we won't iterate over "impossibl= e" > > > > 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. >=20 > 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. >=20 > > 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. > >=20 > > 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 ;-) >=20 > The two most difficult challenges in programming are the last two hard > things that the person speaking worked on. ;-) >=20 ;-) > 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(). >=20 Fair enough. Let us name it for_each_leaf_node_cpu() ;-) Regards, Boqun > Thanx, Paul >=20 > > Regards, > > Boqun > >=20 > > > Thanx, Paul > > >=20 > > > > Will modify that in next version. > > > >=20 > > > > Regards, > > > > Boqun > > > >=20 > > > > > Thanx, Paul > > > > >=20 > > >=20 > > >=20 >=20 >=20 --lMM8JwqTlfDpEaS6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAABCAAGBQJYTJhoAAoJEEl56MO1B/q4qvcH/24/svPI2kIIom/B8SqkM5EY FShLOLc3wNxtI8iT5EfDNqAfjhLv2Oy1ZW+QxbRO8OObQdGv4k0uPsB+IYy7aXFX DkPMbzJ3S9QQWpSPty2mFnWU/O9uTn5gFxAyteTEBeCmfyJc8FRSgCRxSDnjBzxe o8fOfVntD14fRAJ/mIXOCNTCki69jrGB4OKSDQoLcheT7TW+mu05L8zZvc0vfdML 3/zzErrZSEFkcYGdPC2d88BRG01XZ1FW7Yg34rxILuBT3Z4vLQjcG3f2RQk/nO3i IrYDQvUV/JujqbGjZySS6xbqQcs05SInI8SSQIgJyNq3aLC1IbBJh7Rspb2pAi0= =ENK4 -----END PGP SIGNATURE----- --lMM8JwqTlfDpEaS6--