Re: [PATCH v2] sched/rt: fix the case where sched_rt_period_us is negative

From: Valentin Schneider
Date: Tue May 17 2022 - 10:49:01 EST


On 17/05/22 01:55, Yajun Deng wrote:
> May 16, 2022 11:04 PM, "Valentin Schneider" <vschneid@xxxxxxxxxx> wrote:
>>> },
>>> {
>>> .procname = "sched_rt_runtime_us",
>>> @@ -44,6 +45,8 @@ static struct ctl_table sched_rt_sysctls[] = {
>>> .maxlen = sizeof(int),
>>> .mode = 0644,
>>> .proc_handler = sched_rt_handler,
>>> + .extra1 = SYSCTL_NEG_ONE,
>>> + .extra2 = (void *)&sysctl_sched_rt_period,
>>
>> Per this, you could also remove the
>>
>> ((sysctl_sched_rt_runtime > sysctl_sched_rt_period) ||
>>
>> from sched_rt_global_validate(), no?
>>
>
> No, the extra2 just limit the maximum value of sysctl_sched_rt_runtime is sysctl_sched_rt_period, but not limit the minimum value of sysctl_sched_rt_period is sysctl_sched_rt_runtime. (sysctl_sched_rt_runtime > sysctl_sched_rt_period) can do both.

Gotcha.

> Its purpose is to return error earlier. Perhaps I should remove extra2 to avoid ambiguity.
>

It's probably better to only have the "pure" bounds in there yes.