Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539191

[RFC 3/5] rcu: Use leaf_node_for_each_mask_possible_cpu() for ->expmask iteration

From Boqun Feng <boqun.feng@gmail.com>
Newsgroups linux.kernel
Subject [RFC 3/5] rcu: Use leaf_node_for_each_mask_possible_cpu() for ->expmask iteration
Date 2016-12-09 09:50 +0100
Message-ID <sMp2p-12O-11@gated-at.bofh.it> (permalink)
References <sMp2p-12O-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The ->expmask of an RCU leaf node should be more sparse than the
corresponding part of cpu_possible_mask, iterating on ->expmask bitmap
rather cpu_possible_mask to save some checks.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 kernel/rcu/tree_exp.h | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index a3a8756670d1..8c50a1cb9133 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -419,7 +419,7 @@ static void synchronize_sched_expedited_wait(struct rcu_state *rsp)
 	int cpu;
 	unsigned long jiffies_stall;
 	unsigned long jiffies_start;
-	unsigned long mask;
+	unsigned long bit;
 	int ndetected;
 	struct rcu_node *rnp;
 	struct rcu_node *rnp_root = rcu_get_root(rsp);
@@ -444,12 +444,9 @@ static void synchronize_sched_expedited_wait(struct rcu_state *rsp)
 		ndetected = 0;
 		rcu_for_each_leaf_node(rsp, rnp) {
 			ndetected += rcu_print_task_exp_stall(rnp);
-			for_each_leaf_node_possible_cpu(rnp, cpu) {
+			leaf_node_for_each_mask_possible_cpu(rnp, rnp->expmask, bit, cpu) {
 				struct rcu_data *rdp;
 
-				mask = leaf_node_cpu_bit(rnp, cpu);
-				if (!(rnp->expmask & mask))
-					continue;
 				ndetected++;
 				rdp = per_cpu_ptr(rsp->rda, cpu);
 				pr_cont(" %d-%c%c%c", cpu,
@@ -475,14 +472,10 @@ static void synchronize_sched_expedited_wait(struct rcu_state *rsp)
 			}
 			pr_cont("\n");
 		}
-		rcu_for_each_leaf_node(rsp, rnp) {
-			for_each_leaf_node_possible_cpu(rnp, cpu) {
-				mask = leaf_node_cpu_bit(rnp, cpu);
-				if (!(rnp->expmask & mask))
-					continue;
+		rcu_for_each_leaf_node(rsp, rnp)
+			leaf_node_for_each_mask_possible_cpu(rnp, rnp->expmask, bit, cpu)
 				dump_cpu_task(cpu);
-			}
-		}
+
 		jiffies_stall = 3 * rcu_jiffies_till_stall_check() + 3;
 	}
 }
-- 
2.10.2

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[RFC 3/5] rcu: Use leaf_node_for_each_mask_possible_cpu() for ->expmask iteration Boqun Feng <boqun.feng@gmail.com> - 2016-12-09 09:50 +0100

csiph-web