[LTP] [PATCH v3 0/5] Add memcontrol03 and declarative CG API

Richard Palethorpe rpalethorpe@suse.com
Mon Feb 7 15:16:13 CET 2022


This adds a third test from the kselftests. Also I have finally taken
the step of moving the CGroup configuration to tst_test and making it
declarative. Since V2 of the patch this does save a lot of typing and
removes the need to remember to call cleanup. It also puts the CGroup
info into the metadata.

V3:
* Simplify by adding tst_cgroup.h to tst_test.h as suggested by Li Wang
* rm options defaults as suggested by Li
* use abbreviation for controller, same as version as suggesdted by Li
* rm useless checks for V1 in memcontrol03 as suggested by Cyril
* fix format compile error in cfs_bandwidth01 as reported by Li
* Move the group_name fix into the printf patch; reported by Cyril

V2:
* Updated docs
* Updated library tests
* Moved the test/drain cg ptr out of the test struct and allocate
  it statically. This resulted in some overly clever init code
  being removed as well.
* Renamed parent cgs to trunk and child to leaf as technically trunk
  nodes can be both parents and children.
* Matched the cg names in the comments with the variable names
  using enums. So it's easier to see that the description matches
  the code.
* Use waitpid as suggested by Cyril and remove the patch adding
  tst_reap_child.
* unlink the tmpfile to hopefully prevent random storage full errors
  when using -i. We already seek to 0.
* init the fd to -1
* Make tst_cgroup_group_mk sprintf like as suggested by Cyril.

Richard Palethorpe (5):
  memcontrol: Lift out some common definitions into a shared header
  API/cgroup: Declare required controllers and version in test struct
  API/cgroup: Add memory.min
  API/cgroup: Make tst_cgroup_group_mk sprintf like
  memcontrol03: Copy from kselftest

 doc/c-test-api.txt                            | 102 ++++---
 include/tst_cgroup.h                          |  34 +--
 include/tst_test.h                            |   7 +
 lib/newlib_tests/tst_cgroup01.c               |   3 +-
 lib/newlib_tests/tst_cgroup02.c               |  27 +-
 lib/tst_cgroup.c                              |  91 ++++---
 lib/tst_test.c                                |  21 ++
 runtest/controllers                           |   1 +
 testcases/kernel/controllers/memcg/.gitignore |   1 +
 .../kernel/controllers/memcg/memcontrol01.c   |  20 +-
 .../kernel/controllers/memcg/memcontrol02.c   |  45 +---
 .../kernel/controllers/memcg/memcontrol03.c   | 253 ++++++++++++++++++
 .../controllers/memcg/memcontrol_common.h     |  47 ++++
 testcases/kernel/mem/cpuset/cpuset01.c        |  25 +-
 testcases/kernel/mem/include/mem.h            |   1 -
 testcases/kernel/mem/ksm/ksm02.c              |  19 +-
 testcases/kernel/mem/ksm/ksm03.c              |  13 +-
 testcases/kernel/mem/ksm/ksm04.c              |  16 +-
 testcases/kernel/mem/oom/oom03.c              |  24 +-
 testcases/kernel/mem/oom/oom04.c              |  15 +-
 testcases/kernel/mem/oom/oom05.c              |  34 ++-
 .../sched/cfs-scheduler/cfs_bandwidth01.c     |  20 +-
 testcases/kernel/syscalls/madvise/madvise06.c |  29 +-
 23 files changed, 534 insertions(+), 314 deletions(-)
 create mode 100644 testcases/kernel/controllers/memcg/memcontrol03.c
 create mode 100644 testcases/kernel/controllers/memcg/memcontrol_common.h

-- 
2.34.1



More information about the ltp mailing list