lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240522031007.643498-3-serein.chengyu@huawei.com>
Date: Wed, 22 May 2024 11:10:07 +0800
From: Cheng Yu <serein.chengyu@...wei.com>
To: <mingo@...hat.com>, <peterz@...radead.org>, <juri.lelli@...hat.com>,
	<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
	<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
	<bristot@...hat.com>, <vschneid@...hat.com>,
	<changhuaixin@...ux.alibaba.com>, <shanpeic@...ux.alibaba.com>,
	<dtcccc@...ux.alibaba.com>, <tj@...nel.org>, <linux-kernel@...r.kernel.org>
CC: <zhangqiao22@...wei.com>, <judy.chenhui@...wei.com>,
	<yusongping@...wei.com>, <zhaowenhui8@...wei.com>, <liaoqixin@...wei.com>,
	<serein.chengyu@...wei.com>
Subject: [PATCH 2/2] sched/fair: set burst to zero when set max to cpu.max

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@...wei.com>
Signed-off-by: Cheng Yu <serein.chengyu@...wei.com>
---
 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, &quota);
-	if (!ret)
+	if (!ret) {
+		if (quota == RUNTIME_INF)
+			burst = 0;
 		ret = tg_set_cfs_bandwidth(tg, period, quota, burst);
+	}
 	return ret ?: nbytes;
 }
 #endif
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ