[PATCH] selftests/cgroup: Adjust cpu.max quota based on HZ

From: Joe Simmons-Talbott

Date: Fri Jun 19 2026 - 17:19:23 EST


For lower HZ values a quota of 1000us is much lower than the amount
of microseconds per tick which makes the test_cpucg_max and
test_cpugc_max_nested fail. Use the amount of microseconds per tick
as the quota value.

Signed-off-by: Joe Simmons-Talbott <joest@xxxxxxxxxx>
---
tools/testing/selftests/cgroup/test_cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c
index 7a40d76b9548..4ac5d3ecae00 100644
--- a/tools/testing/selftests/cgroup/test_cpu.c
+++ b/tools/testing/selftests/cgroup/test_cpu.c
@@ -646,7 +646,7 @@ test_cpucg_nested_weight_underprovisioned(const char *root)
static int test_cpucg_max(const char *root)
{
int ret = KSFT_FAIL;
- long quota_usec = 1000;
+ long quota_usec = USEC_PER_SEC / sysconf(_SC_CLK_TCK);
long default_period_usec = 100000; /* cpu.max's default period */
long duration_seconds = 1;

@@ -710,7 +710,7 @@ static int test_cpucg_max(const char *root)
static int test_cpucg_max_nested(const char *root)
{
int ret = KSFT_FAIL;
- long quota_usec = 1000;
+ long quota_usec = USEC_PER_SEC / sysconf(_SC_CLK_TCK);
long default_period_usec = 100000; /* cpu.max's default period */
long duration_seconds = 1;

--
2.54.0