Skip to contentSkip to conversation

rcu: Remove reduplicate check of cpu_online

PATCH In review Yao Dongdong 2 participants 2 messages Feb 25, 2015 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcu: Remove reduplicate check of cpu_online

The calling function invoke_rcu_core will check it.

---
 kernel/rcu/tree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
index 48d640c..e5f9b7e 100644
@@ -2741,7 +2741,7 @@ static void __call_rcu_core(struct rcu_state *rsp, struct rcu_data *rdp,
 	 * If called from an extended quiescent state, invoke the RCU
 	 * core in order to force a re-evaluation of RCU's idleness.
 	 */
-	if (!rcu_is_watching() && cpu_online(smp_processor_id()))
+	if (!rcu_is_watching())
 		invoke_rcu_core();
 
 	/* If interrupts were disabled or CPU offline, don't invoke RCU core. */
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 3 lines · Yao Dongdong

The calling function invoke_rcu_core will check it.

Hmmm... That is a fastpath, but invoke_rcu_core() is visible to the compiler, which should inline anyway. I took this patch for 4.1, but updated the title and commit log as follows:

rcu: Remove redundant check of cpu_online()

Because invoke_cpu_core() checks whether the current CPU is online, there is no need for __call_rcu_core() to redundantly check it. There should not be any performance degradation because the called function is visible to the compiler. This commit therefore removes the redundant check.

Thanx, Paul

Quoted 20 lines
---
 kernel/rcu/tree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
index 48d640c..e5f9b7e 100644
@@ -2741,7 +2741,7 @@ static void __call_rcu_core(struct rcu_state *rsp, struct rcu_data *rdp,
 	 * If called from an extended quiescent state, invoke the RCU
 	 * core in order to force a re-evaluation of RCU's idleness.
 	 */
-	if (!rcu_is_watching() && cpu_online(smp_processor_id()))
+	if (!rcu_is_watching())
 		invoke_rcu_core();
 
 	/* If interrupts were disabled or CPU offline, don't invoke RCU core. */
Signature · 1 line
1.7.9.5