[LTP] [PATCH v2 0/3] Add CPU cgroup v2 tests ported from kselftest

Shaojie Sun <[email protected]> Thu, 30 Jul 2026 20:25:18 +0800
Newsgroups it.linux.lists.ltp
Message-ID <[email protected]>
This series ports the CPU cgroup v2 tests from the kernel selftests
(tools/testing/selftests/cgroup/test_cpu.c) to LTP, including tests
for subtree control, cpu.stat, nice, weight, and cpu.max.

Patch 1 adds the necessary cgroup file entries (cpu.stat, cpu.weight)
to the LTP cgroup library.
Patch 2 adds the test source files and build infrastructure.
Patch 3 registers the new tests in runtest/controllers.

v2:
- Changed hog_cpus_timed() to use tst_brk() instead of returning -1
- Removed unused status variables, use NULL for SAFE_WAITPID
- Added copyright lines for the author in new files
- Fixed doc block formatting: use :kselftest: references and blank
  lines before bullet lists for reST rendering
- Removed redundant .needs_cgroup_nsdelegate = 0 initializers
- Removed unused USEC_PER_SEC from cgroup_cpu04.c
- Removed unnecessary drain writes in cleanup paths
- Replaced literal .tcnt values with ARRAY_SIZE(test_list) and
  function pointer tables
- Removed .timeout = 30 default value from cgroup_cpu05.c
- Added errno = 0 before nice() call in cgroup_cpu03.c
- Added .needs_kconfigs check for CONFIG_CFS_BANDWIDTH=y in
  cgroup_cpu05.c
- Added .needs_root = 1 to cgroup_cpu02.c for consistency
- Changed doc comment from /*\ to /* in cgroup_cpu_common.h
  since it is a helper header, not a test

Shaojie Sun (3):
  tst_cgroup: add cpu.stat and cpu.weight to cgroup file table
  cgroup: add CPU cgroup v2 tests ported from kselftest
  runtest/controllers: add CPU cgroup v2 test entries

 lib/tst_cgroup.c                              |   2 +
 runtest/controllers                           |   5 +
 testcases/kernel/controllers/cpu/.gitignore   |   5 +
 testcases/kernel/controllers/cpu/Makefile     |   9 +
 .../kernel/controllers/cpu/cgroup_cpu01.c     |  64 ++++
 .../kernel/controllers/cpu/cgroup_cpu02.c     | 103 ++++++
 .../kernel/controllers/cpu/cgroup_cpu03.c     | 115 ++++++
 .../kernel/controllers/cpu/cgroup_cpu04.c     | 332 ++++++++++++++++++
 .../kernel/controllers/cpu/cgroup_cpu05.c     | 176 ++++++++++
 .../controllers/cpu/cgroup_cpu_common.h       | 131 +++++++
 10 files changed, 942 insertions(+)
 create mode 100644 testcases/kernel/controllers/cpu/.gitignore
 create mode 100644 testcases/kernel/controllers/cpu/Makefile
 create mode 100644 testcases/kernel/controllers/cpu/cgroup_cpu01.c
 create mode 100644 testcases/kernel/controllers/cpu/cgroup_cpu02.c
 create mode 100644 testcases/kernel/controllers/cpu/cgroup_cpu03.c
 create mode 100644 testcases/kernel/controllers/cpu/cgroup_cpu04.c
 create mode 100644 testcases/kernel/controllers/cpu/cgroup_cpu05.c
 create mode 100644 testcases/kernel/controllers/cpu/cgroup_cpu_common.h

-- 
2.25.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp