Re: [PATCH v2] sched/fair: set burst to 0 when remove the restriction on cfs bandwidth

From: Cheng Yu
Date: Tue Jul 09 2024 - 00:05:26 EST


Hi,

On 2024/7/9 2:08, Tejun Heo wrote:
> Hello,
>
> On Mon, Jul 08, 2024 at 08:00:53PM +0800, Cheng Yu wrote:
>> From: Zhao Wenhui <zhaowenhui8@xxxxxxxxxx>
>>
>> In the cpu subsystem of cgroup v1 and v2, we set the restriction on cfs
>> bandwidth by setting the quota and burst value. Later, when we remove
>> the restriction by setting the quota to the default value, the burst
>> value should also be forced to the its default value of zero.
>
> Explaining a bit why burst value should become zero can be helpful - ie.
> what happens when quota is not set but burst is limited?

When the restriction on cfs bandwidth is removed, the purpose of setting
burst value to zero is to avoid ambiguity.

>
> ...
>> @@ -10840,6 +10840,12 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota,
>> burst + quota > max_cfs_runtime))
>> return -EINVAL;
>>
>> + /*
>> + * Ensure burst equals to zero when quota is -1.
>> + */
>> + if (quota == RUNTIME_INF && burst)
>> + return -EINVAL;
>
> This happening would be a bug, right? Would it make more sense to use
> WARN_ON_ONCE()?

As Vishal Chourasia mentioned, it can prevent setting excessively large
burst value. Using WARN_ON_ONCE() does not have this effect.

>
> Thanks.
>

Thanks
--
Cheng Yu