From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758146AbcLOOnd (ORCPT ); Thu, 15 Dec 2016 09:43:33 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34414 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755796AbcLOOnb (ORCPT ); Thu, 15 Dec 2016 09:43:31 -0500 Date: Thu, 15 Dec 2016 22:42:42 +0800 From: Boqun Feng To: Mark Rutland Cc: linux-kernel@vger.kernel.org, "Paul E . McKenney " , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Colin King Subject: Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Message-ID: <20161215144242.GN9728@tardis.cn.ibm.com> References: <20161215024204.28620-1-boqun.feng@gmail.com> <20161215024204.28620-5-boqun.feng@gmail.com> <20161215120459.GE21758@leverpostej> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BtmVPk+Smchi6n7w" Content-Disposition: inline In-Reply-To: <20161215120459.GE21758@leverpostej> 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 --BtmVPk+Smchi6n7w Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 15, 2016 at 12:04:59PM +0000, Mark Rutland wrote: > On Thu, Dec 15, 2016 at 10:42:03AM +0800, Boqun Feng wrote: > > ->qsmask of an RCU leaf node is usually more sparse than the > > corresponding cpu_possible_mask. So replace the > > for_each_leaf_node_possible_cpu() in force_qs_rnp() with > > for_each_leaf_node_cpu() to save several checks. > >=20 > > [Note we need to use "1UL << bit" instead of "1 << bit" to generate the > > corresponding mask for a bit because @mask is unsigned long, this was > > spotted by Colin Ian King and CoverityScan in > > a previous version of this patch.] >=20 > Nit: This note can go now that we use leaf_node_cpu_bit(). ;) >=20 I kinda keep this here for honoring the effort of finding out this bug =66rom Colin, but yes, it's no longer needed here for the current code. Regards, Boqun > Thanks, > Mark. >=20 > > Signed-off-by: Boqun Feng > > --- > > kernel/rcu/tree.c | 12 +++++------- > > 1 file changed, 5 insertions(+), 7 deletions(-) > >=20 > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > index 4e5b81c843de..1ef13e63bc95 100644 > > --- a/kernel/rcu/tree.c > > +++ b/kernel/rcu/tree.c > > @@ -3046,13 +3046,11 @@ static void force_qs_rnp(struct rcu_state *rsp, > > continue; > > } > > } > > - for_each_leaf_node_possible_cpu(rnp, cpu) { > > - unsigned long bit =3D leaf_node_cpu_bit(rnp, cpu); > > - if ((rnp->qsmask & bit) !=3D 0) { > > - if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj)) > > - mask |=3D bit; > > - } > > - } > > + > > + for_each_leaf_node_cpu(rnp, rnp->qsmask, cpu) > > + if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj)) > > + mask |=3D leaf_node_cpu_bit(rnp, cpu); > > + > > if (mask !=3D 0) { > > /* Idle/offline CPUs, report (releases rnp->lock. */ > > rcu_report_qs_rnp(mask, rsp, rnp, rnp->gpnum, flags); > > --=20 > > 2.10.2 > >=20 --BtmVPk+Smchi6n7w Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAABCAAGBQJYUqvcAAoJEEl56MO1B/q4PuQH/iOy62wz3M8j9XX3qDTINOg/ wu8h4dSJoY32TLV7nRa5j3m8RFXxIdwLIHazQL9XsY0TPaH3Li/jNFVpp9e/bnBn qto+ZFP3WLsdyfxxt8D4LgztIk6pQdp0FMgUo0aHuc9xS8VsK4wBBDmrzU8j6LJ3 vYOU24mudA9RXp43G9uZUTE9rlha47LKjj+uGqxh1wbbvdOAQXOi4KN/LqjK14k+ HgtJfF3yZBjpJIX5vEHhbIsI9RdS6v5POZh7HfGuxLjQkziUz+/NsjTyvpamCFF6 a9Y6QkSNHxxTvfc1nLw9c0ZpvYenCqCBIJ5pGXw22AU+B3XD0EVh8m5WBMh00KE= =tPrr -----END PGP SIGNATURE----- --BtmVPk+Smchi6n7w--