Re: [RESEND] sched/fair: Add min_ratio for cfs bandwidth_control

From: Chuyi Zhou
Date: Thu Oct 20 2022 - 02:36:07 EST




在 2022/10/20 05:21, Tejun Heo 写道:
Hello,

On Wed, Oct 19, 2022 at 11:15:51AM +0800, Chuyi Zhou wrote:
Tasks may be throttled when holding locks for a long time by current
cfs bandwidth control mechanism once users set a too small quota/period
ratio, which can result whole system get stuck[1].

In order to prevent the above situation from happening, this patch adds
sysctl_sched_cfs_bandwidth_min_ratio in /proc/sys/kernel, which indicates
the minimum percentage of quota/period users can set. The default value is
zero and users can set quota and period without triggering this constraint.

Link[1]:https://lore.kernel.org/lkml/5987be34-b527-4ff5-a17d-5f6f0dc94d6d@xxxxxxxxxx/T/
Signed-off-by: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
Suggested-by: Abel Wu <wuyun.abel@xxxxxxxxxxxxx>

This is a bit of a bandaid. I think what we really need to do is only
throttling when running in userspace. In kernel space, it should just keep
accumulating used cycles as debt which should be paid back before userspace
code can run again so that we don't throttle at random places in the kernel.

Thanks.

Got it. Thanks for your advice.
Chuyi Zhou