Commit 743f71fc authored by Cheng Yu's avatar Cheng Yu
Browse files

sched/fair: set burst to zero when set max to cpu.max

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9PR8C


CVE: NA

--------------------------------

In the cgroup v2 cpu subsystem, assuming we have a
cgroup named test, 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: f4183717 ("sched/fair: Introduce the burstable CFS controller")
Signed-off-by: default avatarCheng Yu <serein.chengyu@huawei.com>
parent 46edfe61
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -12060,8 +12060,11 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of,
	int ret;

	ret = cpu_period_quota_parse(buf, &period, &quota);
	if (!ret)
	if (!ret) {
		if (quota == RUNTIME_INF)
			burst = 0;
		ret = tg_set_cfs_bandwidth(tg, period, quota, burst);
	}
	return ret ?: nbytes;
}
#endif