selftests: mm: protection_keys: save/restore nr_hugepages value from launch script
authorMuhammad Usama Anjum <usama.anjum@collabora.com>
Fri, 19 Apr 2024 11:50:27 +0000 (16:50 +0500)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 25 Apr 2024 17:07:27 +0000 (10:07 -0700)
commited74abcd1da0244c3c3be865587dc2727148ee83
tree5b7a23a54dd82acea2611d224e55f810713db92b
parent6fe60465e1d53ea321ee909be26d97529e8f746c
selftests: mm: protection_keys: save/restore nr_hugepages value from launch script

The save/restore of nr_hugepages was added to the test itself by using the
atexit() functionality.  But it is broken as parent exits after creating
child.  Hence calling the atexit() function early.  That's not it.  The
child exits after creating its child and so on.

The parent cannot wait to get the termination status for its children as
it'll keep on holding the resources until the new pkey allocation fails.
It is impossible to wait for exits of all the grand and great grand
children.  Hence the restoring of nr_hugepages value from parent is wrong.

Let's save/restore the nr_hugepages settings in the launch script
instead of doing it in the test.

Link: https://lkml.kernel.org/r/20240419115027.3848958-1-usama.anjum@collabora.com
Fixes: c52eb6db7b7d ("selftests: mm: restore settings from only parent process")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Reported-by: Joey Gouly <joey.gouly@arm.com>
Closes: https://lore.kernel.org/all/20240418125250.GA2941398@e124191.cambridge.arm.com
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/protection_keys.c
tools/testing/selftests/mm/run_vmtests.sh