lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161219151515.GP9728@tardis.cn.ibm.com>
Date:   Mon, 19 Dec 2016 23:15:15 +0800
From:   Boqun Feng <boqun.feng@...il.com>
To:     Colin Ian King <colin.king@...onical.com>
Cc:     Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org,
        "Paul E . McKenney " <paulmck@...ux.vnet.ibm.com>,
        Josh Triplett <josh@...htriplett.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Lai Jiangshan <jiangshanlai@...il.com>
Subject: Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp()

On Thu, Dec 15, 2016 at 02:51:36PM +0000, Colin Ian King wrote:
> 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 the
> >>> corresponding mask for a bit because @mask is unsigned long, this was
> >>> spotted by Colin Ian King <colin.king@...onical.com> and CoverityScan in
> >>> a previous version of this patch.]
> >>
> >> Nit: This note can go now that we use leaf_node_cpu_bit(). ;)
> >>
> > 
> > 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.
> 

Paul, here is a modified version of this patch, what I only did is
removing this note.

Besides I rebased the whole series on the current rcu/dev branch of -rcu
tree, on this very commit:

	8e9b2521b18a ("doc: Quick-Quiz answers are now inline")

And I put the latest version at

git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git leaf-node

If you thought it's better, I could send a v3 ;-)

Regards,
Boqun

------------------------>8
From: Boqun Feng <boqun.feng@...il.com>
Date: Thu, 8 Dec 2016 23:21:11 +0800
Subject: [PATCH v2.1 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp()

->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.

Signed-off-by: Boqun Feng <boqun.feng@...il.com>
---
 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 4ea4496f4ecc..c2b753fb7f09 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 = leaf_node_cpu_bit(rnp, cpu);
-			if ((rnp->qsmask & bit) != 0) {
-				if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj))
-					mask |= bit;
-			}
-		}
+
+		for_each_leaf_node_cpu(rnp, rnp->qsmask, cpu)
+			if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj))
+				mask |= leaf_node_cpu_bit(rnp, cpu);
+
 		if (mask != 0) {
 			/* Idle/offline CPUs, report (releases rnp->lock. */
 			rcu_report_qs_rnp(mask, rsp, rnp, rnp->gpnum, flags);
-- 
2.10.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ