Skip to contentSkip to conversation

rcu: Move common code out of if-else block

PATCH Applied Akira Yokosawa 2 participants 2 messages Mar 2, 2019 – Mar 5, 2019 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcu: Move common code out of if-else block

From 97f4bcece9a9beb792b623f847570144a0a71ccc Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 2 Mar 2019 17:25:19 +0900
Subject: [PATCH] rcu: Move common code out of if-else block

As the result of recent addition of "rdp->core_needs_qs = false;" in the "if" block, now both branches of the if-else have the same assignment.

Factor it out and reduce line count.

---
Hi Paul,

This patch is supposed to do the change mentioned in off-the-list correspondence. As the earlier change by Joel has not landed on tip tree, I avoided mentioning the commit id of the change (ac2baf64948d in -rcu as of today) in the change log.

Does this work for you?

Thanks, Akira
--

 kernel/rcu/tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/rcu/tree.c +1 -3
index 7273ef0..449e8a4 100644
@@ -1910,12 +1910,10 @@ rcu_report_qs_rdp(int cpu, struct rcu_data *rdp)
 		return;
 	}
 	mask = rdp->grpmask;
+	rdp->core_needs_qs = false;
 	if ((rnp->qsmask & mask) == 0) {
-		rdp->core_needs_qs = false;
 		raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
 	} else {
-		rdp->core_needs_qs = false;
-
 		/*
 		 * This GP can't end until cpu checks in, so all of our
 		 * callbacks can be processed during the next GP.
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Akira Yokosawa
Quoted 1 line

From 97f4bcece9a9beb792b623f847570144a0a71ccc Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 2 Mar 2019 17:25:19 +0900
Subject: [PATCH] rcu: Move common code out of if-else block

Quoted 8 lines

As the result of recent addition of "rdp->core_needs_qs = false;" in the "if" block, now both branches of the if-else have the same assignment.

Factor it out and reduce line count.

Queued and pushed, thank you both!

It passes (very) light rcutorture testing. I will hit it harder this evening.

Thanx, Paul

Quoted 36 lines

---
Hi Paul,

This patch is supposed to do the change mentioned in off-the-list correspondence. As the earlier change by Joel has not landed on tip tree, I avoided mentioning the commit id of the change (ac2baf64948d in -rcu as of today) in the change log.

Does this work for you?

Thanks, Akira
--

 kernel/rcu/tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/rcu/tree.c +1 -3
index 7273ef0..449e8a4 100644
@@ -1910,12 +1910,10 @@ rcu_report_qs_rdp(int cpu, struct rcu_data *rdp)
 		return;
 	}
 	mask = rdp->grpmask;
+	rdp->core_needs_qs = false;
 	if ((rnp->qsmask & mask) == 0) {
-		rdp->core_needs_qs = false;
 		raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
 	} else {
-		rdp->core_needs_qs = false;
-
 		/*
 		 * This GP can't end until cpu checks in, so all of our
 		 * callbacks can be processed during the next GP.
Signature · 1 line
2.7.4