Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] selftests: cgroup: fix the flaky and vacuous test_memcg_sock
@ 2026-10-12 18:59 Konstantin Khorenko
  2026-10-12 18:59 ` [PATCH 1/2] selftests: cgroup: skip test_memcg_sock under cgroup.memory=nosocket Konstantin Khorenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-10-12 18:59 UTC (permalink / raw)
  To: Tejun Heo, Michal Koutný, Shakeel Butt, Johannes Weiner
  Cc: Michal Hocko, Roman Gushchin, Muchun Song, Shuah Khan,
	Guopeng Zhang, cgroups, linux-mm, linux-kselftest, linux-kernel,
	Konstantin Khorenko

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 <khorenko@virtuozzo.com>



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

end of thread, other threads:[~2026-10-12 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 18:59 [PATCH 0/2] selftests: cgroup: fix the flaky and vacuous test_memcg_sock Konstantin Khorenko
2026-10-12 18:59 ` [PATCH 1/2] selftests: cgroup: skip test_memcg_sock under cgroup.memory=nosocket Konstantin Khorenko
2026-10-12 18:59 ` [PATCH 2/2] selftests: cgroup: make test_memcg_sock check flushed sock stats Konstantin Khorenko
2026-10-12 22:00 ` [PATCH 0/2] selftests: cgroup: fix the flaky and vacuous test_memcg_sock Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox