Re: [RFC PATCH V3 6/6] sched/fair: Implement starvation monitor

From: Daniel Bristot de Oliveira
Date: Fri Jun 16 2023 - 09:27:27 EST


On 6/16/23 13:51, Peter Zijlstra wrote:
> On Thu, Jun 08, 2023 at 05:58:18PM +0200, Daniel Bristot de Oliveira wrote:
>> From: Juri Lelli <juri.lelli@xxxxxxxxxx>
>>
>> Starting deadline server for lower priority classes right away when
>> first task is enqueued might break guarantees, as tasks belonging to
>> intermediate priority classes could be uselessly preempted. E.g., a well
>> behaving (non hog) FIFO task can be preempted by NORMAL tasks even if
>> there are still CPU cycles available for NORMAL tasks to run, as they'll
>> be running inside the fair deadline server for some period of time.
>>
>> To prevent this issue, implement a starvation monitor mechanism that
>
> Why should this be prevented? FIFO can be preempted by a higher
> priority FIFO/RR, or in this case by DEADLINE, and always by stop_task.

Yeah, but in the context of "real-time throttling" the user is not asking to run things
as SCHED_DEADLINE, they are just running FIFO, and expecting it not to have SCHED_OTHER
jumping in front of them.

If we do not "deffer" the starting of the server for a point in which the starvation
is eminent, we can create some anomalies... for example:

A Interrupt wakes up a FIFO and a CFS task, which will will run first? The CFS!

A FIFO schedules a deferred work on a kworker... the kworker will preempt the
FIFO.

It is counter intuitive for the majority of people out there... It will
be counter-intuitive for most of PREEMPT_RT users :-/. From one day to the other
their tests using cyclictest will... break...

> Just accept this.
>
> Anything that's build around FIFO-99 not getting preempted is just plain
> broken. Don't try and pander to broken