mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
rcu-tasks: Remove smp_mb() in rcu_spawn_tasks_kthread_generic()
For the smp_mb() after kthread_run() in rcu_spawn_tasks_kthread_generic() from these commits: 'commiteacd6f04a1("rcu-tasks: Move Tasks RCU to its own file")' 'commit84a8f446ff("rcu: Defer rcu_tasks_kthread() creation till first call_rcu_tasks()")' the memory order pairing as follows: rcu_spawn_tasks_kthread() ->t = kthread_run(rcu_tasks_kthread, ...); ->smp_mb(); /* Ensure others see full kthread. */ ->WRITE_ONCE(rcu_tasks_kthread_ptr, t); call_rcu_tasks() ->if (READ_ONCE(rcu_tasks_kthread_ptr)) ->wake_up(&rcu_tasks_cbs_wq) ->try_to_wake_up() lock pi_lock ->smp_mb__after_spinlock() //see full kthread Because the 'commitd119357d07("rcu-tasks: Treat only synchronous grace periods urgently")' moved the kthread_ptr assignment into the rcu_tasks_kthread() function, the following memory order pairings are sufficient: The runq's raw_spinlock/unlock(or smp_mb__after_spinlock()) from wake_up_process() in kthread_run() and __schedule() provides memory order barrier when the kthread is first scheduled, this ensures the kthread's func observes all of the kthread's initialization. The kthread's smp_store_release(&rtp->kthread_ptr, ...) in rcu_tasks_kthread() and smp_load_acquire(&rtp->kthread_ptr) in call_rcu_tasks_generic() compose release/acquire pairing, the cumulativity of smp_store_release() propagates visibility of the kthread's initialization through the scheduler chain. This commit therefore remove smp_mb() in rcu_spawn_tasks_kthread_generic(). Signed-off-by: Zqiang <qiang.zhang@linux.dev> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
647dd6e094
commit
a781301250
|
|
@ -681,7 +681,6 @@ static void __init rcu_spawn_tasks_kthread_generic(struct rcu_tasks *rtp)
|
|||
t = kthread_run(rcu_tasks_kthread, rtp, "%s_kthread", rtp->kname);
|
||||
if (WARN_ONCE(IS_ERR(t), "%s: Could not start %s grace-period kthread, OOM is now expected behavior\n", __func__, rtp->name))
|
||||
return;
|
||||
smp_mb(); /* Ensure others see full kthread. */
|
||||
}
|
||||
|
||||
#ifndef CONFIG_TINY_RCU
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user