Re: [PATCH] sched: Fix data-race in wakeup
From: Mel Gorman
Date: Tue Nov 17 2020 - 07:40:06 EST
On Tue, Nov 17, 2020 at 09:30:16AM +0100, Peter Zijlstra wrote:
> > sched_psi_wake_requeue can probably stay with the other three fields
> > given they are under the rq lock but sched_remote_wakeup needs to move
> > out.
>
> I _think_ we can move the bit into the unserialized section below.
>
> It's a bit cheecky, but it should work I think because the only time we
> actually use this bit, we're guaranteed the task isn't actually running,
> so current doesn't exist.
>
Putting the bit there has the added advantage that if the bit existed
on its own that it would be very special in terms of how it should be
treated. Adding a bit adjacent to it would be potentially hazardous.
> ---
> Subject: sched: Fix data-race in wakeup
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Date: Tue Nov 17 09:08:41 CET 2020
>
> <SNIP>
>
> Fixes: c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu")
> Reported-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Thanks, testing completed successfully! With the suggested alternative
comment above sched_remote_wakeup;
Reviewed-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
--
Mel Gorman
SUSE Labs