diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2017-06-26 13:49:50 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2017-07-25 16:04:46 -0400 |
commit | 95335c0355834c16cc11f041a981ee6782dba2e9 (patch) | |
tree | b1105efc30a1b319e21a6b5fb1ec040660e77e66 /kernel/rcu/tree.c | |
parent | c47e067a3c57835fe5ce24d50482f5c325a64efd (diff) |
rcu: Check for NOCB CPUs and empty lists earlier in CB migration
The current CPU-hotplug RCU-callback-migration code checks
for the source (newly offlined) CPU being a NOCBs CPU down in
rcu_send_cbs_to_orphanage(). This commit simplifies callback migration a
bit by moving this check up to rcu_migrate_callbacks(). This commit also
adds a check for the source CPU having no callbacks, which eases analysis
of the rcu_send_cbs_to_orphanage() and rcu_adopt_orphan_cbs() functions.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r-- | kernel/rcu/tree.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index f5acf34247fb..aeea697d6f9f 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -3862,10 +3862,6 @@ rcu_send_cbs_to_orphanage(int cpu, struct rcu_state *rsp, | |||
3862 | { | 3862 | { |
3863 | lockdep_assert_held(&rsp->orphan_lock); | 3863 | lockdep_assert_held(&rsp->orphan_lock); |
3864 | 3864 | ||
3865 | /* No-CBs CPUs do not have orphanable callbacks. */ | ||
3866 | if (!IS_ENABLED(CONFIG_HOTPLUG_CPU) || rcu_is_nocb_cpu(rdp->cpu)) | ||
3867 | return; | ||
3868 | |||
3869 | /* | 3865 | /* |
3870 | * Orphan the callbacks. First adjust the counts. This is safe | 3866 | * Orphan the callbacks. First adjust the counts. This is safe |
3871 | * because _rcu_barrier() excludes CPU-hotplug operations, so it | 3867 | * because _rcu_barrier() excludes CPU-hotplug operations, so it |
@@ -3935,6 +3931,9 @@ static void rcu_migrate_callbacks(int cpu, struct rcu_state *rsp) | |||
3935 | struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu); | 3931 | struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu); |
3936 | struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */ | 3932 | struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */ |
3937 | 3933 | ||
3934 | if (rcu_is_nocb_cpu(cpu) || rcu_segcblist_empty(&rdp->cblist)) | ||
3935 | return; /* No callbacks to migrate. */ | ||
3936 | |||
3938 | raw_spin_lock_irqsave(&rsp->orphan_lock, flags); | 3937 | raw_spin_lock_irqsave(&rsp->orphan_lock, flags); |
3939 | rcu_send_cbs_to_orphanage(cpu, rsp, rnp, rdp); | 3938 | rcu_send_cbs_to_orphanage(cpu, rsp, rnp, rdp); |
3940 | rcu_adopt_orphan_cbs(rsp, flags); | 3939 | rcu_adopt_orphan_cbs(rsp, flags); |