aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu/tree.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2017-06-26 20:59:02 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2017-07-25 16:04:48 -0400
commit537b85c870babacc1cf13235e92bee9de86210e0 (patch)
tree233487a7b6a4065e6ef2c8a06b11caba245ab306 /kernel/rcu/tree.c
parent9fa46fb8c9c6dfad30487fb3d905c2ff04b379b7 (diff)
rcu: Eliminate rcu_state ->orphan_lock
The ->orphan_lock is acquired and released only within the rcu_migrate_callbacks() function, which now acquires the root rcu_node structure's ->lock. This commit therefore eliminates the ->orphan_lock in favor of the root rcu_node structure's ->lock. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r--kernel/rcu/tree.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index c080c6ed66af..58ab489eca66 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -97,7 +97,6 @@ struct rcu_state sname##_state = { \
97 .gp_state = RCU_GP_IDLE, \ 97 .gp_state = RCU_GP_IDLE, \
98 .gpnum = 0UL - 300UL, \ 98 .gpnum = 0UL - 300UL, \
99 .completed = 0UL - 300UL, \ 99 .completed = 0UL - 300UL, \
100 .orphan_lock = __RAW_SPIN_LOCK_UNLOCKED(&sname##_state.orphan_lock), \
101 .orphan_pend = RCU_CBLIST_INITIALIZER(sname##_state.orphan_pend), \ 100 .orphan_pend = RCU_CBLIST_INITIALIZER(sname##_state.orphan_pend), \
102 .orphan_done = RCU_CBLIST_INITIALIZER(sname##_state.orphan_done), \ 101 .orphan_done = RCU_CBLIST_INITIALIZER(sname##_state.orphan_done), \
103 .barrier_mutex = __MUTEX_INITIALIZER(sname##_state.barrier_mutex), \ 102 .barrier_mutex = __MUTEX_INITIALIZER(sname##_state.barrier_mutex), \
@@ -3853,15 +3852,12 @@ void rcu_report_dead(unsigned int cpu)
3853 3852
3854/* 3853/*
3855 * Send the specified CPU's RCU callbacks to the orphanage. The 3854 * Send the specified CPU's RCU callbacks to the orphanage. The
3856 * specified CPU must be offline, and the caller must hold the 3855 * specified CPU must be offline.
3857 * ->orphan_lock.
3858 */ 3856 */
3859static void 3857static void
3860rcu_send_cbs_to_orphanage(int cpu, struct rcu_state *rsp, 3858rcu_send_cbs_to_orphanage(int cpu, struct rcu_state *rsp,
3861 struct rcu_node *rnp, struct rcu_data *rdp) 3859 struct rcu_node *rnp, struct rcu_data *rdp)
3862{ 3860{
3863 lockdep_assert_held(&rsp->orphan_lock);
3864
3865 /* 3861 /*
3866 * Orphan the callbacks. First adjust the counts. This is safe 3862 * Orphan the callbacks. First adjust the counts. This is safe
3867 * because _rcu_barrier() excludes CPU-hotplug operations, so it 3863 * because _rcu_barrier() excludes CPU-hotplug operations, so it
@@ -3891,14 +3887,12 @@ rcu_send_cbs_to_orphanage(int cpu, struct rcu_state *rsp,
3891 3887
3892/* 3888/*
3893 * Adopt the RCU callbacks from the specified rcu_state structure's 3889 * Adopt the RCU callbacks from the specified rcu_state structure's
3894 * orphanage. The caller must hold the ->orphan_lock. 3890 * orphanage.
3895 */ 3891 */
3896static void rcu_adopt_orphan_cbs(struct rcu_state *rsp, unsigned long flags) 3892static void rcu_adopt_orphan_cbs(struct rcu_state *rsp, unsigned long flags)
3897{ 3893{
3898 struct rcu_data *rdp = raw_cpu_ptr(rsp->rda); 3894 struct rcu_data *rdp = raw_cpu_ptr(rsp->rda);
3899 3895
3900 lockdep_assert_held(&rsp->orphan_lock);
3901
3902 /* Do the accounting first. */ 3896 /* Do the accounting first. */
3903 if (rsp->orphan_done.len_lazy != rsp->orphan_done.len) 3897 if (rsp->orphan_done.len_lazy != rsp->orphan_done.len)
3904 rcu_idle_count_callbacks_posted(); 3898 rcu_idle_count_callbacks_posted();
@@ -3939,12 +3933,9 @@ static void rcu_migrate_callbacks(int cpu, struct rcu_state *rsp)
3939 } 3933 }
3940 raw_spin_lock_rcu_node(rnp_root); /* irqs already disabled. */ 3934 raw_spin_lock_rcu_node(rnp_root); /* irqs already disabled. */
3941 rcu_advance_cbs(rsp, rnp_root, rdp); /* Leverage recent GPs. */ 3935 rcu_advance_cbs(rsp, rnp_root, rdp); /* Leverage recent GPs. */
3942 raw_spin_unlock_rcu_node(rnp_root);
3943
3944 raw_spin_lock(&rsp->orphan_lock);
3945 rcu_send_cbs_to_orphanage(cpu, rsp, rnp, rdp); 3936 rcu_send_cbs_to_orphanage(cpu, rsp, rnp, rdp);
3946 rcu_adopt_orphan_cbs(rsp, flags); 3937 rcu_adopt_orphan_cbs(rsp, flags);
3947 raw_spin_unlock_irqrestore(&rsp->orphan_lock, flags); 3938 raw_spin_unlock_irqrestore_rcu_node(rnp_root, flags);
3948 WARN_ONCE(rcu_segcblist_n_cbs(&rdp->cblist) != 0 || 3939 WARN_ONCE(rcu_segcblist_n_cbs(&rdp->cblist) != 0 ||
3949 !rcu_segcblist_empty(&rdp->cblist), 3940 !rcu_segcblist_empty(&rdp->cblist),
3950 "rcu_cleanup_dead_cpu: Callbacks on offline CPU %d: qlen=%lu, 1stCB=%p\n", 3941 "rcu_cleanup_dead_cpu: Callbacks on offline CPU %d: qlen=%lu, 1stCB=%p\n",