Re: RT_GROUP_SCHED throttling blocks unthrottled RT tasks?

From: Joel Fernandes
Date: Fri Nov 05 2021 - 19:10:41 EST


On Fri, Nov 5, 2021 at 1:44 PM Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
[..]
>
>
> I tried gathering some tracing. One bit that might (?) be relevant:
>
> cros_ec_spi_hig-179 [000] d.h5 1495.305919: sched_waking:
> comm=kworker/4:2 pid=5232 prio=120 target_cpu=004
> cros_ec_spi_hig-179 [000] d.h6 1495.305926: sched_wakeup:
> comm=kworker/4:2 pid=5232 prio=120 target_cpu=004
> <idle>-0 [001] d.H5 1495.309113: sched_waking:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
> <idle>-0 [001] d.H6 1495.309119: sched_wakeup:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
> cros_ec_spi_hig-179 [000] d.h5 1495.309336: sched_waking:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
> cros_ec_spi_hig-179 [000] d.h6 1495.309341: sched_wakeup:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
> <idle>-0 [001] d.H5 1495.312137: sched_waking:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
> <idle>-0 [001] d.H6 1495.312142: sched_wakeup:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
> cros_ec_spi_hig-179 [000] d.h5 1495.312859: sched_waking:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
> cros_ec_spi_hig-179 [000] d.h6 1495.312870: sched_wakeup:
> comm=sugov:6 pid=2658 prio=-1 target_cpu=006
>
> My best guess is that there's some bug in the scheduler where it just
> loops constantly picking an unthrottled RT task but then incorrectly
> decides that it's throttled and thus doesn't run it.

Thanks for posting this. Tricky bit indeed. I was wondering if the
issue is here:
https://elixir.bootlin.com/linux/latest/source/kernel/sched/rt.c#L1031

Basically, if something is actively getting RT-throttled on a CPU,
then if something else unthrottled but RT is ready to run, the
scheduler does resched_curr(rq) anyway. This probably happens when
update_curr_rt() is called on the unthrottled RT task via
task_tick_rt(). That seems a limitation of the current RT scheduler
I think? Thoughts?