FROMLIST: memcg_control_test: Disable swapping in test cgroup for v2
memcg_control_test_1 sets both a memory limit and a memsw/swap limit to
a single page, and then asks mem_process to allocate 2 pages in an
attempt to cause a memcg OOM kill. However, if swapping is enabled the
first page can be swapped before the second is allocated causing neither
limit to be exceeded in v2 since there is no combined memsw counter in
v2. In this case no OOM kill will occur which results in a test failure.
Fix this by disabling swap in the test cgroup for v2 if swap is enabled,
causing both pages to always be accounted under the same counter such
that memory.max causes an OOM kill.
Fixes: c0b815736 ("New testcase added by Naufal.")
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Link: https://lore.kernel.org/ltp/20250327200044.4104125-1-tjmercier@google.com/
Change-Id: I5af3d5de2e7ecdb98f9b9809a38cf64d66d82d8f
Bug: 404741621
Signed-off-by: T.J. Mercier <tjmercier@google.com>
1 file changed