mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests: cgroup: skip the cpu.max tests without CFS bandwidth control
@ 2026-11-05  1:18 Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2026-11-05  1:18 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Johannes Weiner, Michal Koutný,
	Shuah Khan, David Vernet, cgroups, linux-kselftest, linux-kernel

cpu.max only exists when the kernel is built with CONFIG_CFS_BANDWIDTH,
which arm64's defconfig does not enable. test_cpucg_max and
test_cpucg_max_nested then fail to write it and report a failure.

Skip both tests when cpu.max does not exist, and add CONFIG_CFS_BANDWIDTH
to the cgroup selftests' config.

Fixes: 889ab8113ef1 ("cgroup: Add test_cpucg_max() testcase")
Fixes: a79906570f96 ("cgroup: Add test_cpucg_max_nested() testcase")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Tested on a 144-CPU Grace with KernelCI's arm64 defconfig build of
05441d697f7f9, which has CONFIG_CFS_BANDWIDTH unset: both tests now skip.

 tools/testing/selftests/cgroup/config     |  1 +
 tools/testing/selftests/cgroup/test_cpu.c | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/cgroup/config b/tools/testing/selftests/cgroup/config
index 39f979690dd3b..aaf5872c71410 100644
--- a/tools/testing/selftests/cgroup/config
+++ b/tools/testing/selftests/cgroup/config
@@ -1,3 +1,4 @@
+CONFIG_CFS_BANDWIDTH=y
 CONFIG_CGROUPS=y
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_CGROUP_FREEZER=y
diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c
index 3456e3e988c68..7119aa1db496c 100644
--- a/tools/testing/selftests/cgroup/test_cpu.c
+++ b/tools/testing/selftests/cgroup/test_cpu.c
@@ -694,8 +694,11 @@ static int test_cpucg_max(const char *root)
 	if (cg_create(cpucg))
 		goto cleanup;
 
-	if (cg_write(cpucg, "cpu.max", quota_buf))
+	if (cg_write(cpucg, "cpu.max", quota_buf)) {
+		if (errno == ENOENT)
+			ret = KSFT_SKIP;
 		goto cleanup;
+	}
 
 	struct cpu_hog_func_param param = {
 		.nprocs = 1,
@@ -768,8 +771,11 @@ static int test_cpucg_max_nested(const char *root)
 	if (cg_create(child))
 		goto cleanup;
 
-	if (cg_write(parent, "cpu.max", quota_buf))
+	if (cg_write(parent, "cpu.max", quota_buf)) {
+		if (errno == ENOENT)
+			ret = KSFT_SKIP;
 		goto cleanup;
+	}
 
 	struct cpu_hog_func_param param = {
 		.nprocs = 1,
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-05  1:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05  1:18 [PATCH] selftests: cgroup: skip the cpu.max tests without CFS bandwidth control Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®