Skip to contentSkip to conversation

rcuperf: fix duplicate struct initializer

PATCH In review Arnd Bergmann 3 participants 4 messages Apr 19, 2017 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcuperf: fix duplicate struct initializer

Building with "make W=1" shows a set of new warnings in the rcuperf code:

kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
.async = srcu_call_rcu,
kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async') kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = srcu_rcu_barrier,
kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier') kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
.async = call_rcu_tasks,
kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async') kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = rcu_barrier_tasks,
kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')

This appears to be a copy-paste bug, so we can remove the extranous copy.

Fixes f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")
---
 kernel/rcu/rcuperf.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/rcu/rcuperf.c +0 -4
index 329010a41f30..e1ce97bead94 100644
@@ -279,8 +279,6 @@ static struct rcu_perf_ops sched_ops = {
 	.exp_completed	= rcu_exp_batches_completed_sched,
 	.async		= call_rcu_sched,
 	.gp_barrier	= rcu_barrier_sched,
-	.async		= srcu_call_rcu,
-	.gp_barrier	= srcu_rcu_barrier,
 	.sync		= synchronize_sched,
 	.exp_sync	= synchronize_sched_expedited,
 	.name		= "sched"
@@ -310,8 +308,6 @@ static struct rcu_perf_ops tasks_ops = {
 	.completed	= rcu_no_completed,
 	.async		= call_rcu_tasks,
 	.gp_barrier	= rcu_barrier_tasks,
-	.async		= call_rcu_tasks,
-	.gp_barrier	= rcu_barrier_tasks,
 	.sync		= synchronize_rcu_tasks,
 	.exp_sync	= synchronize_rcu_tasks,
 	.name		= "tasks"
Signature · 1 line
2.9.0
#1 lore raw
Quoted 15 lines · Arnd Bergmann

Building with "make W=1" shows a set of new warnings in the rcuperf code:

kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
.async = srcu_call_rcu,
kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async') kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = srcu_rcu_barrier,
kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier') kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
.async = call_rcu_tasks,
kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async') kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = rcu_barrier_tasks,
kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')

Quoted 4 lines

This appears to be a copy-paste bug, so we can remove the extranous copy.

Fixes f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")

For those times when you want to be -really- sure that the field is in fact initialized! ;-)

Good catch!!! I merged this into the original commit with attribution:

[ paulmck: Removed the redundant initialization noted by Arnd Bergmann. ]

Thanx, Paul

Quoted 29 lines
---
 kernel/rcu/rcuperf.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/rcu/rcuperf.c +0 -4
index 329010a41f30..e1ce97bead94 100644
@@ -279,8 +279,6 @@ static struct rcu_perf_ops sched_ops = {
 	.exp_completed	= rcu_exp_batches_completed_sched,
 	.async		= call_rcu_sched,
 	.gp_barrier	= rcu_barrier_sched,
-	.async		= srcu_call_rcu,
-	.gp_barrier	= srcu_rcu_barrier,
 	.sync		= synchronize_sched,
 	.exp_sync	= synchronize_sched_expedited,
 	.name		= "sched"
@@ -310,8 +308,6 @@ static struct rcu_perf_ops tasks_ops = {
 	.completed	= rcu_no_completed,
 	.async		= call_rcu_tasks,
 	.gp_barrier	= rcu_barrier_tasks,
-	.async		= call_rcu_tasks,
-	.gp_barrier	= rcu_barrier_tasks,
 	.sync		= synchronize_rcu_tasks,
 	.exp_sync	= synchronize_rcu_tasks,
 	.name		= "tasks"
Signature · 1 line
2.9.0
#2 lore raw
Quoted 21 lines · Paul E. McKenney
Quoted 15 lines · Arnd Bergmann

Building with "make W=1" shows a set of new warnings in the rcuperf code:

kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
.async = srcu_call_rcu,
kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async') kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = srcu_rcu_barrier,
kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier') kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
.async = call_rcu_tasks,
kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async') kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = rcu_barrier_tasks,
kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')

Quoted 4 lines

This appears to be a copy-paste bug, so we can remove the extranous copy.

Fixes f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")
Quoted 6 lines

For those times when you want to be -really- sure that the field is in fact initialized! ;-)

Good catch!!! I merged this into the original commit with attribution:

[ paulmck: Removed the redundant initialization noted by Arnd Bergmann. ]

Thanks!

Note that one of them was not redundant but actually incorrect, as it replaced the _rcu_sched variant with the srcu_ variant.

Arnd

#3 lore raw
Quoted 26 lines · Arnd Bergmann
Quoted 24 lines · Paul E. McKenney
Quoted 15 lines · Arnd Bergmann

Building with "make W=1" shows a set of new warnings in the rcuperf code:

kernel/rcu/rcuperf.c:282:11: error: initialized field overwritten [-Werror=override-init]
.async = srcu_call_rcu,
kernel/rcu/rcuperf.c:282:11: note: (near initialization for 'sched_ops.async') kernel/rcu/rcuperf.c:283:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = srcu_rcu_barrier,
kernel/rcu/rcuperf.c:283:16: note: (near initialization for 'sched_ops.gp_barrier') kernel/rcu/rcuperf.c:313:11: error: initialized field overwritten [-Werror=override-init]
.async = call_rcu_tasks,
kernel/rcu/rcuperf.c:313:11: note: (near initialization for 'tasks_ops.async') kernel/rcu/rcuperf.c:314:16: error: initialized field overwritten [-Werror=override-init]
.gp_barrier = rcu_barrier_tasks,
kernel/rcu/rcuperf.c:314:16: note: (near initialization for 'tasks_ops.gp_barrier')

Quoted 4 lines

This appears to be a copy-paste bug, so we can remove the extranous copy.

Fixes f743d20f2cc6 ("rcuperf: Add ability to performance-test call_rcu() and friends")

For those times when you want to be -really- sure that the field is in fact initialized! ;-)

Quoted 8 lines
Quoted 3 lines

Good catch!!! I merged this into the original commit with attribution:

[ paulmck: Removed the redundant initialization noted by Arnd Bergmann. ]

Thanks!

Note that one of them was not redundant but actually incorrect, as it replaced the _rcu_sched variant with the srcu_ variant.

Perhaps that should be mentioned in the changelog.