[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161209084828.11827-5-boqun.feng@gmail.com>
Date: Fri, 9 Dec 2016 16:48:26 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: linux-kernel@...r.kernel.org
Cc: "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>,
Boqun Feng <boqun.feng@...il.com>
Subject: [RFC 4/5] rcu: Use leaf_node_for_each_mask_possible_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
leaf_node_for_each_mask_possible_cpu() to save several checks.
Signed-off-by: Boqun Feng <boqun.feng@...il.com>
---
kernel/rcu/tree.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 5f6802b9ba5f..10162ac71dbe 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3014,6 +3014,7 @@ static void force_qs_rnp(struct rcu_state *rsp,
bool *isidle, unsigned long *maxj)
{
int cpu;
+ unsigned long bit;
unsigned long flags;
unsigned long mask;
struct rcu_node *rnp;
@@ -3047,13 +3048,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;
- }
- }
+
+ leaf_node_for_each_mask_possible_cpu(rnp, rnp->qsmask, bit, cpu)
+ if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj))
+ mask |= 1 << bit;
+
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