Skip to content

Commit cfeac39

Browse files
committed
rcu: Remove unused "cpu" parameter from rcu_report_qs_rdp()
The "cpu" parameter to rcu_report_qs_rdp() is not used, with rdp->cpu being used instead. Furtheremore, every call to rcu_report_qs_rdp() invokes it on rdp->cpu. This commit therefore removes this unused "cpu" parameter and converts a check of rdp->cpu against smp_processor_id() to a WARN_ON_ONCE(). Reported-by: Jann Horn <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent aa40c13 commit cfeac39

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

kernel/rcu/tree.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,7 +2240,7 @@ rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)
22402240
* structure. This must be called from the specified CPU.
22412241
*/
22422242
static void
2243-
rcu_report_qs_rdp(int cpu, struct rcu_data *rdp)
2243+
rcu_report_qs_rdp(struct rcu_data *rdp)
22442244
{
22452245
unsigned long flags;
22462246
unsigned long mask;
@@ -2249,6 +2249,7 @@ rcu_report_qs_rdp(int cpu, struct rcu_data *rdp)
22492249
rcu_segcblist_is_offloaded(&rdp->cblist);
22502250
struct rcu_node *rnp;
22512251

2252+
WARN_ON_ONCE(rdp->cpu != smp_processor_id());
22522253
rnp = rdp->mynode;
22532254
raw_spin_lock_irqsave_rcu_node(rnp, flags);
22542255
if (rdp->cpu_no_qs.b.norm || rdp->gp_seq != rnp->gp_seq ||
@@ -2265,8 +2266,7 @@ rcu_report_qs_rdp(int cpu, struct rcu_data *rdp)
22652266
return;
22662267
}
22672268
mask = rdp->grpmask;
2268-
if (rdp->cpu == smp_processor_id())
2269-
rdp->core_needs_qs = false;
2269+
rdp->core_needs_qs = false;
22702270
if ((rnp->qsmask & mask) == 0) {
22712271
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
22722272
} else {
@@ -2315,7 +2315,7 @@ rcu_check_quiescent_state(struct rcu_data *rdp)
23152315
* Tell RCU we are done (but rcu_report_qs_rdp() will be the
23162316
* judge of that).
23172317
*/
2318-
rcu_report_qs_rdp(rdp->cpu, rdp);
2318+
rcu_report_qs_rdp(rdp);
23192319
}
23202320

23212321
/*

kernel/rcu/tree_plugin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ rcu_preempt_deferred_qs_irqrestore(struct task_struct *t, unsigned long flags)
461461
t->rcu_read_unlock_special.s = 0;
462462
if (special.b.need_qs) {
463463
if (IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD)) {
464-
rcu_report_qs_rdp(rdp->cpu, rdp);
464+
rcu_report_qs_rdp(rdp);
465465
udelay(rcu_unlock_delay);
466466
} else {
467467
rcu_qs();
@@ -791,7 +791,7 @@ void rcu_read_unlock_strict(void)
791791
irqs_disabled() || preempt_count() || !rcu_state.gp_kthread)
792792
return;
793793
rdp = this_cpu_ptr(&rcu_data);
794-
rcu_report_qs_rdp(rdp->cpu, rdp);
794+
rcu_report_qs_rdp(rdp);
795795
udelay(rcu_unlock_delay);
796796
}
797797
EXPORT_SYMBOL_GPL(rcu_read_unlock_strict);

0 commit comments

Comments
 (0)