test_memcg_sock fails now and then, and many of the other runs pass
without having compared anything: tcp_client() checks memory.current
against the "sock " entry of memory.stat before the stats get flushed,
and values_close() accepts 0 against 0, so the test passes without
having compared anything.
The patch series
* skips the test where cgroup.memory=nosocket leaves sockets
uncharged
* makes the test cause the stats flushes it needs instead of waiting
for them: the client keeps the data in the server's socket with a
small receive buffer and reads until enough socket memory has moved
through the cgroup that a memory.stat read must flush, and the final
check allocates and frees anonymous memory in the cgroup before it
reads "sock ". No sleep or poll is left in the test.
Measured on a 48-CPU x86_64 machine, mainline a5ebb76233b79 built with
the Fedora rawhide config
* as is (release)
* with KASAN, lockdep and DEBUG_VM (debug)
test_memcg_sock in 30 runs of test_memcontrol per kernel; "fake" counts
the passes that compared 0 with 0:
unpatched patched
passed fake passed fake
debug kernel 23/30 19 30/30 0
release kernel 30/30 12 30/30 0
With only CPUs 0 and 1 online, the patched test passed 30 of 30 runs on
each kernel.
---
Konstantin Khorenko (2):
selftests: cgroup: skip test_memcg_sock under cgroup.memory=nosocket
selftests: cgroup: make test_memcg_sock check flushed sock stats
.../selftests/cgroup/lib/include/cgroup_util.h | 3 +
tools/testing/selftests/cgroup/test_kmem.c | 2 +-
tools/testing/selftests/cgroup/test_memcontrol.c | 68 +++++++++++++++-------
3 files changed, 52 insertions(+), 21 deletions(-)
---
base-commit: a5ebb76233b79db01e82e061173cb73c6d2b5c6b
change-id:
20261012-b4-prep-vstor-149854-let-test_memcg_sock-compare-flushed-sock-stats-4c394bf06a6b
Best regards,
--
Konstantin Khorenko <[email protected]>