Commit 7d695b1c authored by Muhammad Usama Anjum's avatar Muhammad Usama Anjum Committed by Andrew Morton

selftests/mm: save and restore nr_hugepages value

Save and restore nr_hugepages before changing it during the test.  A test
should not change system wide settings.

Link: https://lkml.kernel.org/r/20240125154608.720072-4-usama.anjum@collabora.comSigned-off-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 20a2191c
...@@ -11,6 +11,8 @@ if [[ $(id -u) -ne 0 ]]; then ...@@ -11,6 +11,8 @@ if [[ $(id -u) -ne 0 ]]; then
exit $ksft_skip exit $ksft_skip
fi fi
nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages)
fault_limit_file=limit_in_bytes fault_limit_file=limit_in_bytes
reservation_limit_file=rsvd.limit_in_bytes reservation_limit_file=rsvd.limit_in_bytes
fault_usage_file=usage_in_bytes fault_usage_file=usage_in_bytes
...@@ -582,3 +584,5 @@ if [[ $do_umount ]]; then ...@@ -582,3 +584,5 @@ if [[ $do_umount ]]; then
umount $cgroup_path umount $cgroup_path
rmdir $cgroup_path rmdir $cgroup_path
fi fi
echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages
...@@ -11,6 +11,7 @@ if [[ $(id -u) -ne 0 ]]; then ...@@ -11,6 +11,7 @@ if [[ $(id -u) -ne 0 ]]; then
exit $ksft_skip exit $ksft_skip
fi fi
nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages)
usage_file=usage_in_bytes usage_file=usage_in_bytes
if [[ "$1" == "-cgroup-v2" ]]; then if [[ "$1" == "-cgroup-v2" ]]; then
...@@ -252,3 +253,5 @@ if [[ $do_umount ]]; then ...@@ -252,3 +253,5 @@ if [[ $do_umount ]]; then
umount $CGROUP_ROOT umount $CGROUP_ROOT
rm -rf $CGROUP_ROOT rm -rf $CGROUP_ROOT
fi fi
echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment