Re: [PATCH 4/4] sched/deadline: Implement fallback mechanism for !fit case

Dietmar Eggemann
2020-04-09T18:43:24Z

On 09.04.20 16:55, Qais Yousef wrote:
> Hi Luca
>
> On 04/09/20 15:00, luca abeni wrote:

[...]

>> There is already a tunable for the SCHED_DEADLINE admission test
>> (/proc/sys/kernel/sched_rt_{runtime,period}_us, if I understand well
>> what you are suggesting). The problem is that it is not easy to find a
>> value for this tunable that guarantees the hard respect of all
>> deadlines.
>
> I don't think it's similar to what I was referring to. But my knowledge about
> DL could have failed me to fully appreciate what you're saying.
>
> This tunable for RT prevents a single task from using 100% CPU time. I think
> DL uses it in a similar manner.
>
> What I meant by overcommiting, is allowing more DL tasks than the system can
> guarantee to meet their deadlines.
>
> For example, in the context of capacity awareness, if you have 2 big cores, but
> 4 DL tasks request a bandwidth that can only be satisfied by the big cores,
> then 2 of them will miss their deadlines (almost) consistently, IIUC.

__dl_overflow() now uses

X = cap_scale(dl_b->bw, rd_capacity(cpu)) instead of X = cpus

in

dl_b->bw * X < dl_b->total_bw - old_bw + new_bw;

As an example, Arm64 Hikey64 with 4 LITTLE and 4 big CPUs uses now
(4x462 + 4x1024)/1024 = 5944/1024 ~ 5,80 instead of 8 CPUs.

On mainline, the rt-app tests:

"tasks" : {
"thread0" : {
"policy" : "SCHED_DEADLINE",
"instance" : 8,
"timer" : {"ref" : "unique0", "period" : 16000, "mode" : "absolute" },
"run" : 10000,
"dl-runtime" :11000,
"dl-period" : 16000,
"dl-deadline" : 16000
}
}

is admitted on this board whereas with the patchset some of the tasks
are rejected:

[rt-app] <crit> [7] sched_setattr returned -1
sched_setattr: failed to set deadline attributes: Device or resource busy

---

IMHO, one of the 3 places where DL Admission Control hooks into is:

__sched_setscheduler -> sched_dl_overflow() ->__dl_overflow() …