Re: [PATCH] sched/rt: RT_RUNTIME_GREED sched feature

From: Clark Williams
Date: Mon Nov 07 2016 - 13:23:11 EST


On Mon, 7 Nov 2016 09:17:55 +0100
Daniel Bristot de Oliveira <bristot@xxxxxxxxxx> wrote:

> The rt throttling mechanism prevents the starvation of non-real-time
> tasks by CPU intensive real-time tasks. In terms of percentage,
> the default behavior allows real-time tasks to run up to 95% of a
> given period, leaving the other 5% of the period for non-real-time
> tasks. In the absence of non-rt tasks, the system goes idle for 5%
> of the period.
>
> Although this behavior works fine for the purpose of avoiding
> bad real-time tasks that can hang the system, some greed users
> want to allow the real-time task to continue running in the absence
> of non-real-time tasks starving. In other words, they do not want to
> see the system going idle.
>
> This patch implements the RT_RUNTIME_GREED scheduler feature for greedy
> users (TM). When enabled, this feature will check if non-rt tasks are
> starving before throttling the real-time task. If the real-time task
> becomes throttled, it will be unthrottled as soon as the system goes
> idle, or when the next period starts, whichever comes first.
>
> This feature is enabled with the following command:
> # echo RT_RUNTIME_GREED > /sys/kernel/debug/sched_features
>

I'm still reviewing the patch, but I have to wonder why bother with making it a scheduler feature?

The SCHED_FIFO definition allows a fifo thread to starve others because a fifo task will run until it yields. Throttling was added as a safety valve to allow starved SCHED_OTHER tasks to get some cpu time. Adding this unconditionally gets us a safety valve for throttling a badly written fifo task, but allows the fifo task to continue to consume cpu cycles if it's not starving anyone.

Or am I missing something that's blazingly obvious?

Clark

Attachment: pgp2dMijy0kbn.pgp
Description: OpenPGP digital signature