[LTP] [PATCH] [PATCH V2] memcg/memcontrol04: Fix race in pagecache allocation measurement

Andrea Cervesato andrea.cervesato@suse.com
Fri Jun 12 11:35:36 CEST 2026


Hi Pavithra,

> The test was failing with memory.current values much lower than expected:
>    TFAIL: (A/B/C memory.current=6684672) ~= 34603008
>    TFAIL: (A/B/D memory.current=5373952) ~= 17825792
> 
> Root cause:
> Child processes allocating pagecache were exiting immediately after
> allocation (via tst_reap_children()), causing the pagecache to be
> freed before the test could measure memory.current values.
> 
> Fix:
> Modified alloc_pagecache_in_child() to keep children alive during test:
> - Added TEST_DONE checkpoint for child lifecycle coordination
> - Parent waits for CHILD_IDLE checkpoint before proceeding
> - Child signals CHILD_IDLE after allocation and fsync
> - Child waits for TEST_DONE to keep memory allocated during test
> - Modified cleanup_sub_groups() to wake waiting children before cleanup
> - Changed alloc_anon_in_child() to use SAFE_WAITPID() for specific child
> - Added num_children_spawned tracking for accurate cleanup

This commit message is extremely verbose, please make it simpler the
next time. Something explaining the root cause it's there and it's ok,
but the Fix: section is self explained inside the diff code.


The rest LGTM.

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list