All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 0/3] Add CPU cgroup v2 tests ported from kselftest
@ 2026-07-30 12:25 Shaojie Sun
  2026-07-30 12:25 ` [LTP] [PATCH v2 1/3] tst_cgroup: add cpu.stat and cpu.weight to cgroup file table Shaojie Sun
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Shaojie Sun @ 2026-07-30 12:25 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [LTP] [PATCH 1/3] tst_cgroup: add cpu.stat and cpu.weight to cgroup file table
@ 2026-07-30  3:28 Shaojie Sun
  2026-07-30  7:04 ` [LTP] " linuxtestproject.agent
  0 siblings, 1 reply; 11+ messages in thread
From: Shaojie Sun @ 2026-07-30  3:28 UTC (permalink / raw)
  To: ltp

These entries are needed by the upcoming CPU cgroup v2 tests
(cgroup_cpu01 through cgroup_cpu05) to read cpu.stat and set
cpu.weight on cgroups.

Signed-off-by: Shaojie Sun <sunshaojie@kylinos.cn>
---
 lib/tst_cgroup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
index 7c6ecd4d2..8a27ce287 100644
--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -199,6 +199,8 @@ static const struct cgroup_file cpu_ctrl_files[] = {
 	 */
 	{ "cpu.max", "cpu.cfs_quota_us", CTRL_CPU },
 	{ "cpu.cfs_period_us", "cpu.cfs_period_us", CTRL_CPU },
+	{ "cpu.stat", NULL, CTRL_CPU },
+	{ "cpu.weight", NULL, CTRL_CPU },
 	{ }
 };
 
-- 
2.25.1


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-07-31  6:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 12:25 [LTP] [PATCH v2 0/3] Add CPU cgroup v2 tests ported from kselftest Shaojie Sun
2026-07-30 12:25 ` [LTP] [PATCH v2 1/3] tst_cgroup: add cpu.stat and cpu.weight to cgroup file table Shaojie Sun
2026-07-30 14:06   ` [LTP] " linuxtestproject.agent
2026-07-31  3:13   ` [LTP] [PATCH v3 0/3] Add CPU cgroup v2 tests ported from kselftest Shaojie Sun
2026-07-31  3:13     ` [LTP] [PATCH v3 1/3] tst_cgroup: add cpu.stat and cpu.weight to cgroup file table Shaojie Sun
2026-07-31  6:20       ` [LTP] " linuxtestproject.agent
2026-07-31  3:13     ` [LTP] [PATCH v3 2/3] cgroup: add CPU cgroup v2 tests ported from kselftest Shaojie Sun
2026-07-31  3:13     ` [LTP] [PATCH v3 3/3] runtest/controllers: add CPU cgroup v2 test entries Shaojie Sun
2026-07-30 12:25 ` [LTP] [PATCH v2 2/3] cgroup: add CPU cgroup v2 tests ported from kselftest Shaojie Sun
2026-07-30 12:25 ` [LTP] [PATCH v2 3/3] runtest/controllers: add CPU cgroup v2 test entries Shaojie Sun
  -- strict thread matches above, loose matches on Subject: below --
2026-07-30  3:28 [LTP] [PATCH 1/3] tst_cgroup: add cpu.stat and cpu.weight to cgroup file table Shaojie Sun
2026-07-30  7:04 ` [LTP] " linuxtestproject.agent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.