On Mon, Jan 21, 2019 at 04:52:40PM +0100, Andrea Parri wrote:
> move_queued_task() synchronizes with task_rq_lock() as follows:
> 
>       move_queued_task()              task_rq_lock()
> 
>       [S] ->on_rq = MIGRATING         [L] rq = task_rq()
>       WMB (__set_task_cpu())          ACQUIRE (rq->lock);
>       [S] ->cpu = new_cpu             [L] ->on_rq
> 
> where "[L] rq = task_rq()" is ordered before "ACQUIRE (rq->lock)" by an
> address dependency and, in turn, "ACQUIRE (rq->lock)" is ordered before
> "[L] ->on_rq" by the ACQUIRE itself.
> 
> Use READ_ONCE() to load ->cpu in task_rq() (c.f., task_cpu()) to honor
> this address dependency.  Also, mark the accesses to ->cpu and ->on_rq
> with READ_ONCE()/WRITE_ONCE() to comply with the LKMM.
> 
> Signed-off-by: Andrea Parri <[email protected]>

Thanks!

Reply via email to