From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: devel@openvz.org, Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: [Devel] [PATCH hci-8.1 0/2] selftests: cgroup: fix the flaky and vacuous test_memcg_sock
Date: Mon, 19 Oct 2026 21:47:32 +0200 [thread overview]
Message-ID: <20261019-b4-prep-khorenko-vstor-149854-selftests-test_memcg_sock-v1-0-efbfa45dc967@virtuozzo.com> (raw)
test_memcg_sock compares memory.current of its cgroup with the "sock "
entry of memory.stat. memory.current moves at charge time, "sock " only
when the memcg stats are flushed, and nothing in the test makes a flush
happen. So the test either compares 0 with 0 and passes without having
checked anything, or fails at random.
This tree is worse off than mainline was before the fix: the final
check reads "sock " once, right after the connection is closed, with no
wait at all. Mainline polled for 3 seconds there (6360d444ae32), this
tree never got that commit.
It fails here
=============
10.193.16.26 (4 CPUs), test_memcontrol run 100 times before and after
the series, interleaved:
kernel before after
6.12.0-211.52.1.22.8.vz10 (release) 0 failed 0 failed
6.12.0-211.52.1.22.8.vz10 (debug) 5 failed 0 failed
Every failure on the debug kernel is the final check: the client part
of the test had passed, the single read still saw the socket memory.
The release kernel passes here only because the machine is small. A
memory.stat read flushes once MEMCG_CHARGE_BATCH pages per online CPU
of updates are pending, so on 4 CPUs the test traffic crosses the
threshold by itself. On a 48-CPU host mainline's test failed 8 of 30
runs on a debug kernel, and most of its passes compared 0 with 0.
The patches
===========
Both are in mainline's cgroup tree, cgroup/for-7.4:
https://lore.kernel.org/r/20261012-b4-prep-vstor-149854-let-test_memcg_sock-compare-flushed-sock-stats-v1-0-bc864b1950ad@virtuozzo.com
- 1/2 skips the test under cgroup.memory=nosocket, where no socket
memory is charged and the test can only pass on 0 == 0.
- 2/2 makes the test cause the flushes it needs instead of waiting for
them: the client keeps the data in the server's socket 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 ".
The backport differs from mainline only as the Conflict: notes say:
- 1/2 sizes its buffer with PAGE_SIZE, mainline renamed it to BUF_SIZE
- 2/2 replaces the single "sock " read, not mainline's poll
https://virtuozzo.atlassian.net/browse/VSTOR-149854
---
Konstantin Khorenko (2):
ms/selftests: cgroup: skip test_memcg_sock under cgroup.memory=nosocket
ms/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 | 56 ++++++++++++++++++++--
3 files changed, 55 insertions(+), 6 deletions(-)
---
base-commit: 8026fb5599f945a36a6911f8febad3ab569176da
change-id: 20261019-b4-prep-khorenko-vstor-149854-selftests-test_memcg_sock-6c864da317a3
Best regards,
--
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next reply other threads:[~2026-10-19 19:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 19:47 Konstantin Khorenko [this message]
2026-10-19 19:47 ` [Devel] [PATCH hci-8.1 1/2] ms/selftests: cgroup: skip test_memcg_sock under cgroup.memory=nosocket Konstantin Khorenko
2026-10-19 19:50 ` no-reply
2026-10-19 19:47 ` [Devel] [PATCH hci-8.1 2/2] ms/selftests: cgroup: make test_memcg_sock check flushed sock stats Konstantin Khorenko
2026-10-19 19:50 ` no-reply
2026-10-19 19:59 ` [Devel] [PATCH hci-8.1 0/2] selftests: cgroup: fix the flaky and vacuous test_memcg_sock Konstantin Khorenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261019-b4-prep-khorenko-vstor-149854-selftests-test_memcg_sock-v1-0-efbfa45dc967@virtuozzo.com \
--to=khorenko@virtuozzo.com \
--cc=devel@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.