Re: [PATCH 2/2] sched/fair: set burst to zero when set max to cpu.max
From: Benjamin Segall
Date: Tue May 28 2024 - 19:10:54 EST
Cheng Yu <serein.chengyu@xxxxxxxxxx> writes:
> In the cgroup v2 cpu subsystem, assuming we have a cgroup named 'test',
> and we set cpu.max and cpu.max.burst:
> # echo 1000000 > /sys/fs/cgroup/test/cpu.max
> # echo 1000000 > /sys/fs/cgroup/test/cpu.max.burst
>
> Next we remove the restriction on cfs bandwidth:
> # echo max > /sys/fs/cgroup/test/cpu.max
> # cat /sys/fs/cgroup/test/cpu.max
> max 100000
> # cat /sys/fs/cgroup/test/cpu.max.burst
> 1000000
>
> Now we expect that the value of burst should be 0. When the burst is 0,
> it means that the restriction on burst is cancelled.
>
> Fixes: f4183717b370 ("sched/fair: Introduce the burstable CFS controller")
> Reported-by: Qixin Liao <liaoqixin@xxxxxxxxxx>
> Signed-off-by: Cheng Yu <serein.chengyu@xxxxxxxxxx>
Yeah, makes sense. My general assumption would be to put these in one
patch, but if there's a convention to separate v1 and v2 that I've
missed, I have no opinion.
Reviewed-by: Ben Segall <bsegall@xxxxxxxxxx>
> ---
> kernel/sched/core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index e9198e30bb74..982d357b3983 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -11414,8 +11414,11 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of,
> int ret;
>
> ret = cpu_period_quota_parse(buf, &period, "a);
> - if (!ret)
> + if (!ret) {
> + if (quota == RUNTIME_INF)
> + burst = 0;
> ret = tg_set_cfs_bandwidth(tg, period, quota, burst);
> + }
> return ret ?: nbytes;
> }
> #endif