[LTP] [PATCH v2] memcg/functional: fix memcg_failcnt intermittent timeout by disabling swap
Xuewen Wang
wangxuewen@kylinos.cn
Fri Aug 7 04:00:25 CEST 2026
Hi Li Wang,
Thank you for the review and the suggestions. I've sent v3 with the changes you proposed:
- Move swapoff to do_setup() and swapon to do_cleanup()
- Adjust the order in do_cleanup() to swapon first, then memcg_cleanup
Please take a look when you have time.
Best regards,
Xuewen Wang
在 2026/8/5 15:34, Li Wang 写道:
> Hi Xuewen,
>
> Xuewen Wang wrote:
>
>> memcg_failcnt.sh tests the memory.failcnt counter by allocating
>> reclaimable memory (mmap-anon/mmap-file/shm) beyond a tiny cgroup
>> limit (1 page). It relies on the process being OOM-killed so that
>> signal_memcg_process()'s wait loop exits.
>>
>> With swap enabled the kernel usually still OOM-kills the process,
>> but on arm64 reclaim (swap out) sometimes succeeds instead:
>> usage_in_bytes stays at the limit and the process keeps running,
>> so the wait loop times out (TBROK) intermittently.
>>
>> Example failure on arm64 (kernel 6.6):
>> memcg_failcnt 2 TBROK: timed out on memory.usage_in_bytes 4096 0 8192
>>
>> Disable swap around the allocation and re-enable it afterwards,
>> mirroring what memcg_limit_in_bytes.sh already does for the same
>> reclaimable memory types.
>
> This fix make sense, but I'd rather go with a tidy way:
>
> ...
> TST_SETUP=do_setup
> TST_CLEANUP=do_cleanup
>
> do_setup()
> {
> memcg_setup
> swapoff -a
> }
>
> do_cleanup()
> {
> swapon -a
> memcg_cleanup
> }
>
> ...
>
> My Red Hat email address is no longer used. Please CC my new
> address for future versions:
>
> li.wang@linux.dev
> or:
> liwang@hygon.cn
>
More information about the ltp
mailing list