Re: [PATCH] sched: Better document ttwu()

2020-07-04 Thread Valentin Schneider
On 03/07/20 14:32, Peter Zijlstra wrote: > Dave hit the problem fixed by commit: > > b6e13e85829f ("sched/core: Fix ttwu() race") > > and failed to understand much of the code involved. Per his request a > few comments to (hopefully) clarify things. > > Requested-by: Dave Chinner > Signed-off-

[PATCH] sched: Better document ttwu()

2020-07-03 Thread Peter Zijlstra
Dave hit the problem fixed by commit: b6e13e85829f ("sched/core: Fix ttwu() race") and failed to understand much of the code involved. Per his request a few comments to (hopefully) clarify things. Requested-by: Dave Chinner Signed-off-by: Peter Zijlstra (Intel) --- include/linux/sched.h |

Re: [RFC][PATCH] sched: Better document ttwu()

2020-07-03 Thread Vincent Guittot
Hi Peter, On Thu, 2 Jul 2020 at 14:52, Peter Zijlstra wrote: > > > Dave hit the problem fixed by commit: > > b6e13e85829f ("sched/core: Fix ttwu() race") > > and failed to understand much of the code involved. Per his request a > few comments to (hopefully) clarify things. > > Requested-by: Dav

Re: [RFC][PATCH] sched: Better document ttwu()

2020-07-03 Thread Peter Zijlstra
On Fri, Jul 03, 2020 at 10:30:12AM +0200, Peter Zijlstra wrote: > On Thu, Jul 02, 2020 at 07:39:16PM +0100, Valentin Schneider wrote: > > > @@ -3134,8 +3274,12 @@ static inline void prepare_task(struct task_struct > > > *next) > > > /* > > >* Claim the task as running, we do this bef

Re: [RFC][PATCH] sched: Better document ttwu()

2020-07-03 Thread Dietmar Eggemann
On 02/07/2020 14:52, Peter Zijlstra wrote: > > Dave hit the problem fixed by commit: > > b6e13e85829f ("sched/core: Fix ttwu() race") > > and failed to understand much of the code involved. Per his request a > few comments to (hopefully) clarify things. > > Requested-by: Dave Chinner > Signe

Re: [RFC][PATCH] sched: Better document ttwu()

2020-07-03 Thread Peter Zijlstra
On Thu, Jul 02, 2020 at 07:39:16PM +0100, Valentin Schneider wrote: > > + * Special state: > > + * > > + * System-calls and anything external will use task_rq_lock() which > > acquires > > + * both p->lock and rq->lock. As a consequence the state they change is > > stable > > + * while holding e

Re: [RFC][PATCH] sched: Better document ttwu()

2020-07-02 Thread Valentin Schneider
Hi, On 02/07/20 13:52, Peter Zijlstra wrote: > Dave hit the problem fixed by commit: > > b6e13e85829f ("sched/core: Fix ttwu() race") > > and failed to understand much of the code involved. Per his request a > few comments to (hopefully) clarify things. > All of the below is already tremendou

Re: [RFC][PATCH] sched: Better document ttwu()

2020-07-02 Thread Peter Zijlstra
On Thu, Jul 02, 2020 at 09:13:19AM -0400, Phil Auld wrote: > On Thu, Jul 02, 2020 at 02:52:11PM +0200 Peter Zijlstra wrote: > > + * p->on_cpu <- { 0, 1 }: > > + * > > + * is set by prepare_task() and cleared by finish_task() such that it > > will be > > + * set before p is scheduled-in and cl

Re: [RFC][PATCH] sched: Better document ttwu()

2020-07-02 Thread Phil Auld
Hi Peter, On Thu, Jul 02, 2020 at 02:52:11PM +0200 Peter Zijlstra wrote: > > Dave hit the problem fixed by commit: > > b6e13e85829f ("sched/core: Fix ttwu() race") > > and failed to understand much of the code involved. Per his request a > few comments to (hopefully) clarify things. > > Re

[RFC][PATCH] sched: Better document ttwu()

2020-07-02 Thread Peter Zijlstra
Dave hit the problem fixed by commit: b6e13e85829f ("sched/core: Fix ttwu() race") and failed to understand much of the code involved. Per his request a few comments to (hopefully) clarify things. Requested-by: Dave Chinner Signed-off-by: Peter Zijlstra (Intel) --- include/linux/sched.h |