mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Boqun Feng <boqun.feng@gmail.com>
Subject: [RFC 4/5] rcu: Use leaf_node_for_each_mask_possible_cpu() in force_qs_rnp()
Date: Fri,  9 Dec 2016 16:48:26 +0800	[thread overview]
Message-ID: <20161209084828.11827-5-boqun.feng@gmail.com> (raw)
In-Reply-To: <20161209084828.11827-1-boqun.feng@gmail.com>

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

  parent reply	other threads:[~2016-12-09  8:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09  8:48 [RFC 0/5] rcu: Introduce leaf_node_for_each_mask_possible_cpu() and its friend Boqun Feng
2016-12-09  8:48 ` [RFC 1/5] rcu: Introduce primitives to iterate mask bits in an RCU leaf node Boqun Feng
2016-12-09  8:48 ` [RFC 2/5] rcu: Use leaf_node_for_each_mask_possible_cpu() in RCU stall checking Boqun Feng
2016-12-09  8:48 ` [RFC 3/5] rcu: Use leaf_node_for_each_mask_possible_cpu() for ->expmask iteration Boqun Feng
2016-12-09  8:48 ` Boqun Feng [this message]
2016-12-09  8:48 ` [RFC 5/5] rcu: Use leaf_node_for_each_mask_*() for leaf node online CPU iteration Boqun Feng
2016-12-09 23:49 ` [RFC 0/5] rcu: Introduce leaf_node_for_each_mask_possible_cpu() and its friend Paul E. McKenney
2016-12-10  0:45   ` Boqun Feng
2016-12-10  4:28     ` Paul E. McKenney
2016-12-10 13:36       ` Boqun Feng
2016-12-10 17:38         ` Paul E. McKenney
2016-12-11  0:06           ` Boqun Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161209084828.11827-5-boqun.feng@gmail.com \
    --to=boqun.feng@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome