selftests: mm: restore settings from only parent process
authorMuhammad Usama Anjum <usama.anjum@collabora.com>
Thu, 14 Mar 2024 09:40:45 +0000 (14:40 +0500)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 26 Mar 2024 18:07:21 +0000 (11:07 -0700)
commitc52eb6db7b7dd8b4b338b16c5c37df22a6b08fdf
tree22b2a6f46f6942e3ae0c514bf89d4e0148656e7f
parent950bf45d3bbfdb373772ed4d32b5f90e8532fcce
selftests: mm: restore settings from only parent process

The atexit() is called from parent process as well as forked processes.
Hence the child restores the settings at exit while the parent is still
executing.  Fix this by checking pid of atexit() calling process and only
restore THP number from parent process.

Link: https://lkml.kernel.org/r/20240314094045.157149-1-usama.anjum@collabora.com
Fixes: c23ea61726d5 ("selftests/mm: protection_keys: save/restore nr_hugepages settings")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Tested-by: 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