diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-07-03 20:22:34 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-08-30 19:02:55 -0400 |
commit | 336a4f6c451e488b5388a2593fa20f7192706c7b (patch) | |
tree | 973308dbd01ac0cacd2cff27db9b0ea06536feaa /kernel | |
parent | de8e87305a1ae878f7c518fd9cadcc9159cda493 (diff) |
rcu: Remove rsp parameter from rcu_get_root()
There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions. This commit therefore removes the rsp parameter from
rcu_get_root().
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rcu/tree.c | 38 | ||||
-rw-r--r-- | kernel/rcu/tree_exp.h | 6 | ||||
-rw-r--r-- | kernel/rcu/tree_plugin.h | 2 |
3 files changed, 23 insertions, 23 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 1a2956d9e999..8d0e18faab3b 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -623,9 +623,9 @@ EXPORT_SYMBOL_GPL(rcutorture_get_gp_data); | |||
623 | /* | 623 | /* |
624 | * Return the root node of the specified rcu_state structure. | 624 | * Return the root node of the specified rcu_state structure. |
625 | */ | 625 | */ |
626 | static struct rcu_node *rcu_get_root(struct rcu_state *rsp) | 626 | static struct rcu_node *rcu_get_root(void) |
627 | { | 627 | { |
628 | return &rsp->node[0]; | 628 | return &rcu_state.node[0]; |
629 | } | 629 | } |
630 | 630 | ||
631 | /* | 631 | /* |
@@ -1318,7 +1318,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gp_seq) | |||
1318 | unsigned long gpa; | 1318 | unsigned long gpa; |
1319 | unsigned long j; | 1319 | unsigned long j; |
1320 | int ndetected = 0; | 1320 | int ndetected = 0; |
1321 | struct rcu_node *rnp = rcu_get_root(rsp); | 1321 | struct rcu_node *rnp = rcu_get_root(); |
1322 | long totqlen = 0; | 1322 | long totqlen = 0; |
1323 | 1323 | ||
1324 | /* Kick and suppress, if so configured. */ | 1324 | /* Kick and suppress, if so configured. */ |
@@ -1367,7 +1367,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gp_seq) | |||
1367 | pr_err("All QSes seen, last %s kthread activity %ld (%ld-%ld), jiffies_till_next_fqs=%ld, root ->qsmask %#lx\n", | 1367 | pr_err("All QSes seen, last %s kthread activity %ld (%ld-%ld), jiffies_till_next_fqs=%ld, root ->qsmask %#lx\n", |
1368 | rsp->name, j - gpa, j, gpa, | 1368 | rsp->name, j - gpa, j, gpa, |
1369 | jiffies_till_next_fqs, | 1369 | jiffies_till_next_fqs, |
1370 | rcu_get_root(rsp)->qsmask); | 1370 | rcu_get_root()->qsmask); |
1371 | /* In this case, the current CPU might be at fault. */ | 1371 | /* In this case, the current CPU might be at fault. */ |
1372 | sched_show_task(current); | 1372 | sched_show_task(current); |
1373 | } | 1373 | } |
@@ -1389,7 +1389,7 @@ static void print_cpu_stall(struct rcu_state *rsp) | |||
1389 | int cpu; | 1389 | int cpu; |
1390 | unsigned long flags; | 1390 | unsigned long flags; |
1391 | struct rcu_data *rdp = this_cpu_ptr(&rcu_data); | 1391 | struct rcu_data *rdp = this_cpu_ptr(&rcu_data); |
1392 | struct rcu_node *rnp = rcu_get_root(rsp); | 1392 | struct rcu_node *rnp = rcu_get_root(); |
1393 | long totqlen = 0; | 1393 | long totqlen = 0; |
1394 | 1394 | ||
1395 | /* Kick and suppress, if so configured. */ | 1395 | /* Kick and suppress, if so configured. */ |
@@ -1835,7 +1835,7 @@ static bool rcu_gp_init(struct rcu_state *rsp) | |||
1835 | unsigned long oldmask; | 1835 | unsigned long oldmask; |
1836 | unsigned long mask; | 1836 | unsigned long mask; |
1837 | struct rcu_data *rdp; | 1837 | struct rcu_data *rdp; |
1838 | struct rcu_node *rnp = rcu_get_root(rsp); | 1838 | struct rcu_node *rnp = rcu_get_root(); |
1839 | 1839 | ||
1840 | WRITE_ONCE(rsp->gp_activity, jiffies); | 1840 | WRITE_ONCE(rsp->gp_activity, jiffies); |
1841 | raw_spin_lock_irq_rcu_node(rnp); | 1841 | raw_spin_lock_irq_rcu_node(rnp); |
@@ -1962,7 +1962,7 @@ static bool rcu_gp_init(struct rcu_state *rsp) | |||
1962 | */ | 1962 | */ |
1963 | static bool rcu_gp_fqs_check_wake(struct rcu_state *rsp, int *gfp) | 1963 | static bool rcu_gp_fqs_check_wake(struct rcu_state *rsp, int *gfp) |
1964 | { | 1964 | { |
1965 | struct rcu_node *rnp = rcu_get_root(rsp); | 1965 | struct rcu_node *rnp = rcu_get_root(); |
1966 | 1966 | ||
1967 | /* Someone like call_rcu() requested a force-quiescent-state scan. */ | 1967 | /* Someone like call_rcu() requested a force-quiescent-state scan. */ |
1968 | *gfp = READ_ONCE(rsp->gp_flags); | 1968 | *gfp = READ_ONCE(rsp->gp_flags); |
@@ -1981,7 +1981,7 @@ static bool rcu_gp_fqs_check_wake(struct rcu_state *rsp, int *gfp) | |||
1981 | */ | 1981 | */ |
1982 | static void rcu_gp_fqs(struct rcu_state *rsp, bool first_time) | 1982 | static void rcu_gp_fqs(struct rcu_state *rsp, bool first_time) |
1983 | { | 1983 | { |
1984 | struct rcu_node *rnp = rcu_get_root(rsp); | 1984 | struct rcu_node *rnp = rcu_get_root(); |
1985 | 1985 | ||
1986 | WRITE_ONCE(rsp->gp_activity, jiffies); | 1986 | WRITE_ONCE(rsp->gp_activity, jiffies); |
1987 | rsp->n_force_qs++; | 1987 | rsp->n_force_qs++; |
@@ -2010,7 +2010,7 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) | |||
2010 | bool needgp = false; | 2010 | bool needgp = false; |
2011 | unsigned long new_gp_seq; | 2011 | unsigned long new_gp_seq; |
2012 | struct rcu_data *rdp; | 2012 | struct rcu_data *rdp; |
2013 | struct rcu_node *rnp = rcu_get_root(rsp); | 2013 | struct rcu_node *rnp = rcu_get_root(); |
2014 | struct swait_queue_head *sq; | 2014 | struct swait_queue_head *sq; |
2015 | 2015 | ||
2016 | WRITE_ONCE(rsp->gp_activity, jiffies); | 2016 | WRITE_ONCE(rsp->gp_activity, jiffies); |
@@ -2058,7 +2058,7 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) | |||
2058 | WRITE_ONCE(rsp->gp_activity, jiffies); | 2058 | WRITE_ONCE(rsp->gp_activity, jiffies); |
2059 | rcu_gp_slow(rsp, gp_cleanup_delay); | 2059 | rcu_gp_slow(rsp, gp_cleanup_delay); |
2060 | } | 2060 | } |
2061 | rnp = rcu_get_root(rsp); | 2061 | rnp = rcu_get_root(); |
2062 | raw_spin_lock_irq_rcu_node(rnp); /* GP before rsp->gp_seq update. */ | 2062 | raw_spin_lock_irq_rcu_node(rnp); /* GP before rsp->gp_seq update. */ |
2063 | 2063 | ||
2064 | /* Declare grace period done. */ | 2064 | /* Declare grace period done. */ |
@@ -2094,7 +2094,7 @@ static int __noreturn rcu_gp_kthread(void *arg) | |||
2094 | unsigned long j; | 2094 | unsigned long j; |
2095 | int ret; | 2095 | int ret; |
2096 | struct rcu_state *rsp = arg; | 2096 | struct rcu_state *rsp = arg; |
2097 | struct rcu_node *rnp = rcu_get_root(rsp); | 2097 | struct rcu_node *rnp = rcu_get_root(); |
2098 | 2098 | ||
2099 | rcu_bind_gp_kthread(); | 2099 | rcu_bind_gp_kthread(); |
2100 | for (;;) { | 2100 | for (;;) { |
@@ -2190,14 +2190,14 @@ static int __noreturn rcu_gp_kthread(void *arg) | |||
2190 | * which is released before return. | 2190 | * which is released before return. |
2191 | */ | 2191 | */ |
2192 | static void rcu_report_qs_rsp(unsigned long flags) | 2192 | static void rcu_report_qs_rsp(unsigned long flags) |
2193 | __releases(rcu_get_root(rsp)->lock) | 2193 | __releases(rcu_get_root()->lock) |
2194 | { | 2194 | { |
2195 | struct rcu_state *rsp = &rcu_state; | 2195 | struct rcu_state *rsp = &rcu_state; |
2196 | 2196 | ||
2197 | raw_lockdep_assert_held_rcu_node(rcu_get_root(rsp)); | 2197 | raw_lockdep_assert_held_rcu_node(rcu_get_root()); |
2198 | WARN_ON_ONCE(!rcu_gp_in_progress()); | 2198 | WARN_ON_ONCE(!rcu_gp_in_progress()); |
2199 | WRITE_ONCE(rsp->gp_flags, READ_ONCE(rsp->gp_flags) | RCU_GP_FLAG_FQS); | 2199 | WRITE_ONCE(rsp->gp_flags, READ_ONCE(rsp->gp_flags) | RCU_GP_FLAG_FQS); |
2200 | raw_spin_unlock_irqrestore_rcu_node(rcu_get_root(rsp), flags); | 2200 | raw_spin_unlock_irqrestore_rcu_node(rcu_get_root(), flags); |
2201 | rcu_gp_kthread_wake(rsp); | 2201 | rcu_gp_kthread_wake(rsp); |
2202 | } | 2202 | } |
2203 | 2203 | ||
@@ -2654,7 +2654,7 @@ static void force_quiescent_state(struct rcu_state *rsp) | |||
2654 | return; | 2654 | return; |
2655 | rnp_old = rnp; | 2655 | rnp_old = rnp; |
2656 | } | 2656 | } |
2657 | /* rnp_old == rcu_get_root(rsp), rnp == NULL. */ | 2657 | /* rnp_old == rcu_get_root(), rnp == NULL. */ |
2658 | 2658 | ||
2659 | /* Reached the root of the rcu_node tree, acquire lock. */ | 2659 | /* Reached the root of the rcu_node tree, acquire lock. */ |
2660 | raw_spin_lock_irqsave_rcu_node(rnp_old, flags); | 2660 | raw_spin_lock_irqsave_rcu_node(rnp_old, flags); |
@@ -2679,7 +2679,7 @@ rcu_check_gp_start_stall(struct rcu_state *rsp, struct rcu_node *rnp, | |||
2679 | const unsigned long gpssdelay = rcu_jiffies_till_stall_check() * HZ; | 2679 | const unsigned long gpssdelay = rcu_jiffies_till_stall_check() * HZ; |
2680 | unsigned long flags; | 2680 | unsigned long flags; |
2681 | unsigned long j; | 2681 | unsigned long j; |
2682 | struct rcu_node *rnp_root = rcu_get_root(rsp); | 2682 | struct rcu_node *rnp_root = rcu_get_root(); |
2683 | static atomic_t warned = ATOMIC_INIT(0); | 2683 | static atomic_t warned = ATOMIC_INIT(0); |
2684 | 2684 | ||
2685 | if (!IS_ENABLED(CONFIG_PROVE_RCU) || rcu_gp_in_progress() || | 2685 | if (!IS_ENABLED(CONFIG_PROVE_RCU) || rcu_gp_in_progress() || |
@@ -3397,7 +3397,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp) | |||
3397 | { | 3397 | { |
3398 | unsigned long flags; | 3398 | unsigned long flags; |
3399 | struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu); | 3399 | struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu); |
3400 | struct rcu_node *rnp = rcu_get_root(rsp); | 3400 | struct rcu_node *rnp = rcu_get_root(); |
3401 | 3401 | ||
3402 | /* Set up local state, ensuring consistent view of global state. */ | 3402 | /* Set up local state, ensuring consistent view of global state. */ |
3403 | raw_spin_lock_irqsave_rcu_node(rnp, flags); | 3403 | raw_spin_lock_irqsave_rcu_node(rnp, flags); |
@@ -3646,7 +3646,7 @@ static void rcu_migrate_callbacks(int cpu, struct rcu_state *rsp) | |||
3646 | unsigned long flags; | 3646 | unsigned long flags; |
3647 | struct rcu_data *my_rdp; | 3647 | struct rcu_data *my_rdp; |
3648 | struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu); | 3648 | struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu); |
3649 | struct rcu_node *rnp_root = rcu_get_root(rdp->rsp); | 3649 | struct rcu_node *rnp_root = rcu_get_root(); |
3650 | bool needwake; | 3650 | bool needwake; |
3651 | 3651 | ||
3652 | if (rcu_is_nocb_cpu(cpu) || rcu_segcblist_empty(&rdp->cblist)) | 3652 | if (rcu_is_nocb_cpu(cpu) || rcu_segcblist_empty(&rdp->cblist)) |
@@ -3744,7 +3744,7 @@ static int __init rcu_spawn_gp_kthread(void) | |||
3744 | for_each_rcu_flavor(rsp) { | 3744 | for_each_rcu_flavor(rsp) { |
3745 | t = kthread_create(rcu_gp_kthread, rsp, "%s", rsp->name); | 3745 | t = kthread_create(rcu_gp_kthread, rsp, "%s", rsp->name); |
3746 | BUG_ON(IS_ERR(t)); | 3746 | BUG_ON(IS_ERR(t)); |
3747 | rnp = rcu_get_root(rsp); | 3747 | rnp = rcu_get_root(); |
3748 | raw_spin_lock_irqsave_rcu_node(rnp, flags); | 3748 | raw_spin_lock_irqsave_rcu_node(rnp, flags); |
3749 | rsp->gp_kthread = t; | 3749 | rsp->gp_kthread = t; |
3750 | if (kthread_prio) { | 3750 | if (kthread_prio) { |
diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index 298a6904bbcd..0bcbb03c9702 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h | |||
@@ -288,7 +288,7 @@ static bool exp_funnel_lock(struct rcu_state *rsp, unsigned long s) | |||
288 | { | 288 | { |
289 | struct rcu_data *rdp = per_cpu_ptr(&rcu_data, raw_smp_processor_id()); | 289 | struct rcu_data *rdp = per_cpu_ptr(&rcu_data, raw_smp_processor_id()); |
290 | struct rcu_node *rnp = rdp->mynode; | 290 | struct rcu_node *rnp = rdp->mynode; |
291 | struct rcu_node *rnp_root = rcu_get_root(rsp); | 291 | struct rcu_node *rnp_root = rcu_get_root(); |
292 | 292 | ||
293 | /* Low-contention fastpath. */ | 293 | /* Low-contention fastpath. */ |
294 | if (ULONG_CMP_LT(READ_ONCE(rnp->exp_seq_rq), s) && | 294 | if (ULONG_CMP_LT(READ_ONCE(rnp->exp_seq_rq), s) && |
@@ -479,7 +479,7 @@ static void synchronize_sched_expedited_wait(struct rcu_state *rsp) | |||
479 | unsigned long mask; | 479 | unsigned long mask; |
480 | int ndetected; | 480 | int ndetected; |
481 | struct rcu_node *rnp; | 481 | struct rcu_node *rnp; |
482 | struct rcu_node *rnp_root = rcu_get_root(rsp); | 482 | struct rcu_node *rnp_root = rcu_get_root(); |
483 | int ret; | 483 | int ret; |
484 | 484 | ||
485 | trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("startwait")); | 485 | trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("startwait")); |
@@ -643,7 +643,7 @@ static void _synchronize_rcu_expedited(struct rcu_state *rsp, | |||
643 | 643 | ||
644 | /* Wait for expedited grace period to complete. */ | 644 | /* Wait for expedited grace period to complete. */ |
645 | rdp = per_cpu_ptr(&rcu_data, raw_smp_processor_id()); | 645 | rdp = per_cpu_ptr(&rcu_data, raw_smp_processor_id()); |
646 | rnp = rcu_get_root(rsp); | 646 | rnp = rcu_get_root(); |
647 | wait_event(rnp->exp_wq[rcu_seq_ctr(s) & 0x3], | 647 | wait_event(rnp->exp_wq[rcu_seq_ctr(s) & 0x3], |
648 | sync_exp_work_done(rsp, s)); | 648 | sync_exp_work_done(rsp, s)); |
649 | smp_mb(); /* Workqueue actions happen before return. */ | 649 | smp_mb(); /* Workqueue actions happen before return. */ |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 99f517035a6e..545e4ac9422a 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -685,7 +685,7 @@ static void rcu_print_detail_task_stall_rnp(struct rcu_node *rnp) | |||
685 | */ | 685 | */ |
686 | static void rcu_print_detail_task_stall(struct rcu_state *rsp) | 686 | static void rcu_print_detail_task_stall(struct rcu_state *rsp) |
687 | { | 687 | { |
688 | struct rcu_node *rnp = rcu_get_root(rsp); | 688 | struct rcu_node *rnp = rcu_get_root(); |
689 | 689 | ||
690 | rcu_print_detail_task_stall_rnp(rnp); | 690 | rcu_print_detail_task_stall_rnp(rnp); |
691 | rcu_for_each_leaf_node(rsp, rnp) | 691 | rcu_for_each_leaf_node(rsp, rnp) |