Re: [PATCH] selftests/mm: pkeys: wait for the child in become_child()
From: Kevin Brodsky
Date: Fri Nov 13 2026 - 10:22:19 EST
On 06/11/2026 22:57, Andrew Morton wrote:
> On Fri, 6 Nov 2026 17:46:39 +0100 Carlos López <clopez@xxxxxxx> wrote:
>
>> become_child() forks during test_pkey_alloc_exhaust() and has the parent
>> exit, so that the remaining tests run in the child. However, the test
>> runner only waits for the original process, so it sees the test finish
>> early with a success status while the remaining tests keep running in
>> the background. Failures after the first fork are thus not reported in
>> the exit status, and the remaining tests overlap with the next selftest.
>>
>> Fix this by waiting for the child in the parent and exiting with its
>> status. A previous fix avoided waiting, arguing that the parents would
>> keep holding their resources [1]. Particularly, the parent keeps the
>> hugetlb reservation of its test memory, so the child runs out of hugetlb
>> pages after a few iterations. Avoid this by freeing the test memory
>> before waiting.
> Thanks.
>
>> tools/testing/selftests/mm/protection_keys.c | 16 +++++++++++++---
> get_maintainer coverage of selftests is poor, alas. So it's a good
> idea to poke around in the git-blame output to figure out who best to
> cc. I added four new lucky duckies to this thread.
Thanks, looks sensible to me. These pkeys kselftests really rely on a
lot of (black) magic...
Reviewed-by: Kevin Brodsky <kevin.brodsky@xxxxxxx>