From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758441AbcLOOwT (ORCPT ); Thu, 15 Dec 2016 09:52:19 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:47746 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758408AbcLOOwR (ORCPT ); Thu, 15 Dec 2016 09:52:17 -0500 Subject: Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() To: Boqun Feng , Mark Rutland References: <20161215024204.28620-1-boqun.feng@gmail.com> <20161215024204.28620-5-boqun.feng@gmail.com> <20161215120459.GE21758@leverpostej> <20161215144242.GN9728@tardis.cn.ibm.com> Cc: linux-kernel@vger.kernel.org, "Paul E . McKenney " , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan From: Colin Ian King Message-ID: <05a9953b-aaa4-6117-b120-85c12ad56ace@canonical.com> Date: Thu, 15 Dec 2016 14:51:36 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161215144242.GN9728@tardis.cn.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tM3LqS7QlVem1gjnCsC0pvPeaCLAM8gV4" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tM3LqS7QlVem1gjnCsC0pvPeaCLAM8gV4 Content-Type: multipart/mixed; boundary="qJEC6LSDhdAJQKsL7vb29kQOwpeAX3S9m"; protected-headers="v1" From: Colin Ian King To: Boqun Feng , Mark Rutland Cc: linux-kernel@vger.kernel.org, "Paul E . McKenney " , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan Message-ID: <05a9953b-aaa4-6117-b120-85c12ad56ace@canonical.com> Subject: Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() References: <20161215024204.28620-1-boqun.feng@gmail.com> <20161215024204.28620-5-boqun.feng@gmail.com> <20161215120459.GE21758@leverpostej> <20161215144242.GN9728@tardis.cn.ibm.com> In-Reply-To: <20161215144242.GN9728@tardis.cn.ibm.com> --qJEC6LSDhdAJQKsL7vb29kQOwpeAX3S9m Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 15/12/16 14:42, Boqun Feng wrote: > 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. >>> >>> [Note we need to use "1UL << bit" instead of "1 << bit" to generate t= he >>> 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.] >> >> 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 > from Colin, but yes, it's no longer needed here for the current code. Yep, remove it. >=20 > Regards, > Boqun >=20 >> Thanks, >> Mark. >> >>> Signed-off-by: Boqun Feng >>> --- >>> kernel/rcu/tree.c | 12 +++++------- >>> 1 file changed, 5 insertions(+), 7 deletions(-) >>> >>> 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 *rs= p, >>> 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 >>> --qJEC6LSDhdAJQKsL7vb29kQOwpeAX3S9m-- --tM3LqS7QlVem1gjnCsC0pvPeaCLAM8gV4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQI2BAEBCAAgBQJYUq34GRxjb2xpbi5raW5nQGNhbm9uaWNhbC5jb20ACgkQaMKH 38aoAibsSQ//dRKM3Ool7sB9tr62cdCMkitB67zy+Sfe2VaEdxjdUBzgx55WpC7H S3SrMIuXf1SmiZ1GMHxU/YLz2fvbtepdOpr9LRjpk0xA51yNCx8doa/v1dt1Kc/e CljtNAwoAFPCguLccxGQj2xazFx2rWCDjKqoh3pn9hZmNDZpb0YKOSkPp8U7Yw/s fzbMY17zdac7FyenFTFTDdNVCeFWp8TeYx0nInXaXE18yz1oga/W6FtneOLdUuXE u6eRH6sQ3xQ8I+fSlu7WiwlWUmBmoEyJXT5K/fkgvRui2im8Ja8eCbUgVOZenKsW aruiaYjnHf4i4zzYUPrVtD0gRGmKBvDhZtKdrHb3wlDnyg6cV78E6tRFzad0XiDz wxQYD+hOHysoOdu8KSy5t8Fs3goQt9+6r2OyfPeQX93dGDMgW4mPn7cuxaCvB0Ur S7MWkr7BDW2bvkfj3f2GqVBQUxviu9PVxuEAr/MV/0z/OVRhEeZ7AAWlDn0huuSy tOvLJvkjzmALn67GbFntvB2MnK6Y1A+bkspMUXe8zPWrHl+VxVHg+d5egpkjb5sn OEoB077/OnxWljzlMtFKhky3dMZZ78J2j2voGzxJeah6AseuWnPlpU9+zCCZtzWi eaj7hnOy2t8d3o9dl6sfTmchRuqZARjL8HFqiqqxA128ZmPYZaw3np0= =m2lM -----END PGP SIGNATURE----- --tM3LqS7QlVem1gjnCsC0pvPeaCLAM8gV4--