if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
return 0;
- WRITE_ONCE(rcu_state.n_online_cpus, rcu_state.n_online_cpus - 1);
+ atomic_dec(&rcu_state.n_online_cpus);
/* Adjust any no-longer-needed kthreads. */
rcu_boost_kthread_setaffinity(rnp, -1);
// Stop-machine done, so allow nohz_full to disable tick.
* in the code, without the need for additional memory barriers.
* Those memory barriers are provided by CPU-hotplug code.
*/
- ret = READ_ONCE(rcu_state.n_online_cpus) <= 1;
+ ret = atomic_read(&rcu_state.n_online_cpus) <= 1;
preempt_enable();
return ret;
}
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
rcu_spawn_one_boost_kthread(rnp);
rcu_spawn_cpu_nocb_kthread(cpu);
- WRITE_ONCE(rcu_state.n_online_cpus, rcu_state.n_online_cpus + 1);
+ atomic_inc(&rcu_state.n_online_cpus);
return 0;
}
/* Hierarchy levels (+1 to */
/* shut bogus gcc warning) */
int ncpus; /* # CPUs seen so far. */
- int n_online_cpus; /* # CPUs online for RCU. */
+ atomic_t n_online_cpus; /* # CPUs online for RCU. */
/* The following fields are guarded by the root rcu_node's lock. */