Re: [PATCH] sched/fair: don't assign runtime for throttled cfs_rq

From: Valentin Schneider
Date: Fri Aug 16 2019 - 10:02:10 EST


On 16/08/2019 08:08, Liangyan wrote:
> Please check below dmesg log with âWARN_ON(cfs_rq->runtime_remaining > 0)â. If apply my patch, the warning is gone. Append the reproducing case in the end.
>

[...]

Huh, thanks for the log & the reproducer. I'm still struggling to
understand how we could hit the condition you're adding, since
account_cfs_rq_runtime() shouldn't be called for throttled cfs_rqs (which
I guess is the bug). Also, if the cfs_rq is throttled, shouldn't we
prevent any further decrement of its ->runtime_remaining ?

I had a look at the callers of account_cfs_rq_runtime():

- update_curr(). Seems safe, but has a cfs_rq->curr check at the top. This
won't catch throttled cfs_rq's because AFAICT their curr pointer isn't
NULL'd on throttle.

- check_enqueue_throttle(). Already has a cfs_rq_throttled() check.

- set_next_task_fair(). Peter shuffled the whole set/put task thing
recently but last I looked it seemed all sane.

I'll try to make sense of it, but have also Cc'd Paul since unlike me he
actually knows this stuff.