Skip to contentSkip to conversation

selftests/cgroup: Adjust cpu test duration based on HZ

PATCH Applied Joe Simmons-Talbott 3 participants 3 messages Jun 26 – Jun 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 selftests/cgroup: Adjust cpu test duration based on HZ

For lower HZ values a quota of 1000us is much lower than the amount of microseconds per tick which makes the tests test_cpucg_max and test_cpugc_max_nested fail. Increase the test duration to accommodate for lower HZ values.

---
CC: [email protected]
v4 -> v5:
- Get rid of added duration_XXX variables

v3 -> v4:
- Use usec for adjusting test duration for better accuracy.
- Remove underscore from static function
- Use 1000 as the fallback value for hz since it's the default.

v2 -> v3:
- Instead of changing cpu.max quota extend the test duration based on the HZ value.
- don't call pclose() if popen() fails.
- check return value of fscanf().

v1 -> v2:
- Try checking /proc/config.gz to get the actual kernel HZ value and fallback to 1000 if the value cannot be determined.

 .../cgroup/lib/include/cgroup_util.h          |  1 +
 tools/testing/selftests/cgroup/test_cpu.c     | 43 ++++++++++++++++---
 2 files changed, 38 insertions(+), 6 deletions(-)
tools/testing/selftests/cgroup/lib/include/cgroup_util.h +1 -0
index febc1723d090..8ebb2b4d4ec0 100644
@@ -8,6 +8,7 @@
 
 #define MB(x) (x << 20)
 
+#define NSEC_PER_USEC	1000L
 #define USEC_PER_SEC	1000000L
 #define NSEC_PER_SEC	1000000000L
 
tools/testing/selftests/cgroup/test_cpu.c +37 -6

89 lines not on this page · raw message

Signature · 1 line
2.54.0
maintainer Acked-by on v5 1/1
#1 lore raw
Quoted 3 lines · Joe Simmons-Talbott
 .../cgroup/lib/include/cgroup_util.h          |  1 +
 tools/testing/selftests/cgroup/test_cpu.c     | 43 ++++++++++++++++---
 2 files changed, 38 insertions(+), 6 deletions(-)