Messages in this thread Patch in this message | | | From | Rong Tao <> | Subject | [PATCH 2/2] stop_machine: Apply smp_store_release() to multi_stop_data::state | Date | Fri, 20 Oct 2023 22:43:34 +0800 |
| |
From: Rong Tao <rongtao@cestc.cn>
Replace smp_wmb()+WRITE_ONCE() with smp_store_release() and add comment.
Signed-off-by: Rong Tao <rongtao@cestc.cn> --- kernel/stop_machine.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 268c2e581698..cdf4a3fe0348 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -183,8 +183,10 @@ static void set_state(struct multi_stop_data *msdata, { /* Reset ack counter. */ atomic_set(&msdata->thread_ack, msdata->num_threads); - smp_wmb(); - WRITE_ONCE(msdata->state, newstate); + /* This smp_store_release() pair with READ_ONCE() in multi_cpu_stop(). + * Avoid potential access multi_stop_data::state race behaviour. + */ + smp_store_release(&msdata->state, newstate); } /* Last one to ack a state moves to the next state. */ -- 2.41.0
| |