mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Tejun Heo <tj@kernel.org>
Cc: "Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Shuah Khan" <shuah@kernel.org>,
	"David Vernet" <void@manifault.com>,
	cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] selftests: cgroup: skip the cpu.max tests without CFS bandwidth control
Date: Wed,  4 Nov 2026 20:18:27 -0500	[thread overview]
Message-ID: <20261105011827.1143972-1-sashal@kernel.org> (raw)

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


                 reply	other threads:[~2026-11-05  1:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261105011827.1143972-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=shuah@kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®