[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190201082647.GA31498@hirez.programming.kicks-ass.net>
Date: Fri, 1 Feb 2019 09:26:48 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Andrea Parri <andrea.parri@...rulasolutions.com>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
"Paul E. McKenney" <paulmck@...ux.ibm.com>,
Alan Stern <stern@...land.harvard.edu>,
Will Deacon <will.deacon@....com>
Subject: Re: [PATCH v2] sched: Use READ_ONCE()/WRITE_ONCE() in
move_queued_task()/task_rq_lock()
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 <andrea.parri@...rulasolutions.com>
Thanks!
Powered by blists - more mailing lists