Skip to contentSkip to conversation

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

PATCH Superseded Joe Simmons-Talbott 1 participant 1 message Jun 19

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
 tools/testing/selftests/cgroup/test_cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/cgroup/test_cpu.c +2 -2
index 7a40d76b9548..4ac5d3ecae00 100644
@@ -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;
 
Signature · 1 line
2.54.0