Skip to contentSkip to conversation

rcu: Remove some superfluous lines

PATCH In review Peter Zijlstra 2 participants 4 messages Mar 10, 2016 – Apr 12, 2016 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcu: Remove some superfluous lines

I think you'll find this condition is superfluous, as the whole function is under #ifdef of that same.

---
 kernel/rcu/tree.c | 3 ---
 1 file changed, 3 deletions(-)
kernel/rcu/tree.c +0 -3
index 4f7369d54de0..dd2646e56456 100644
@@ -4237,9 +4237,6 @@ static void rcu_cleanup_dying_idle_cpu(int cpu, struct rcu_state *rsp)
 	struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu);
 	struct rcu_node *rnp = rdp->mynode;  /* Outgoing CPU's rdp & rnp. */
 
-	if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
-		return;
-
 	/* Remove outgoing CPU from mask in the leaf rcu_node structure. */
 	mask = rdp->grpmask;
 	raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
#1 lore raw
Quoted 5 lines · Peter Zijlstra

I think you'll find this condition is superfluous, as the whole function is under #ifdef of that same.

Right you are! It got moved under that #ifdef in the process of merging the RCU, hotplug, and swait changes, and I failed to notice. Good catch!

I will apply this to my tree once -rc1 comes out, as it will apply to -rcu at that point.

Or maybe we should remove the #ifdef and add IS_ENABLED() to the other functions under that #ifdef. Thoughts?

Thanx, Paul

Quoted 19 lines
---
 kernel/rcu/tree.c | 3 ---
 1 file changed, 3 deletions(-)
kernel/rcu/tree.c +0 -3
index 4f7369d54de0..dd2646e56456 100644
@@ -4237,9 +4237,6 @@ static void rcu_cleanup_dying_idle_cpu(int cpu, struct rcu_state *rsp)
 	struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu);
 	struct rcu_node *rnp = rdp->mynode;  /* Outgoing CPU's rdp & rnp. */
 
-	if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
-		return;
-
 	/* Remove outgoing CPU from mask in the leaf rcu_node structure. */
 	mask = rdp->grpmask;
 	raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
#2 lore raw
Quoted 7 lines · Paul E. McKenney
Quoted 5 lines · Peter Zijlstra

I think you'll find this condition is superfluous, as the whole function is under #ifdef of that same.

Quoted 8 lines

Right you are! It got moved under that #ifdef in the process of merging the RCU, hotplug, and swait changes, and I failed to notice. Good catch!

I will apply this to my tree once -rc1 comes out, as it will apply to -rcu at that point.

Or maybe we should remove the #ifdef and add IS_ENABLED() to the other functions under that #ifdef. Thoughts?

I'd go with the #ifdef, its the conventional pattern.

#3 lore raw
Quoted 11 lines · Peter Zijlstra
Quoted 10 lines · Paul E. McKenney
Quoted 5 lines · Peter Zijlstra

I think you'll find this condition is superfluous, as the whole function is under #ifdef of that same.

Right you are! It got moved under that #ifdef in the process of merging the RCU, hotplug, and swait changes, and I failed to notice. Good catch!

Quoted 7 lines
Quoted 5 lines

I will apply this to my tree once -rc1 comes out, as it will apply to -rcu at that point.

Or maybe we should remove the #ifdef and add IS_ENABLED() to the other functions under that #ifdef. Thoughts?

I'd go with the #ifdef, its the conventional pattern.

Longer term, I am moving from #ifdef to IS_ENABLED(), as it makes for easier detection of compiler errors in oddball combinations of Kconfig options. But no point in carrying redundant code in the meantime, so queued for 4.8.

Thanx, Paul