From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Andrew Morton <akpm@linux-foundation.org>, Shuah Khan <shuah@kernel.org>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
kernel@collabora.com, Ryan Roberts <ryan.roberts@arm.com>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/5] selftests/mm: save and restore nr_hugepages value
Date: Thu, 25 Jan 2024 20:46:06 +0500 [thread overview]
Message-ID: <20240125154608.720072-4-usama.anjum@collabora.com> (raw)
In-Reply-To: <20240125154608.720072-1-usama.anjum@collabora.com>
Save and restore nr_hugepages before changing it during the test. A test
should not change system wide settings.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 4 ++++
tools/testing/selftests/mm/hugetlb_reparenting_test.sh | 3 +++
2 files changed, 7 insertions(+)
diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
index e14bdd4455f2d..d680c00d2853a 100755
--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
+++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
@@ -11,6 +11,8 @@ if [[ $(id -u) -ne 0 ]]; then
exit $ksft_skip
fi
+nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages)
+
fault_limit_file=limit_in_bytes
reservation_limit_file=rsvd.limit_in_bytes
fault_usage_file=usage_in_bytes
@@ -582,3 +584,5 @@ if [[ $do_umount ]]; then
umount $cgroup_path
rmdir $cgroup_path
fi
+
+echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages
diff --git a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
index 615c4d766c909..11f9bbe7dc222 100755
--- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
+++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
@@ -11,6 +11,7 @@ if [[ $(id -u) -ne 0 ]]; then
exit $ksft_skip
fi
+nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages)
usage_file=usage_in_bytes
if [[ "$1" == "-cgroup-v2" ]]; then
@@ -252,3 +253,5 @@ if [[ $do_umount ]]; then
umount $CGROUP_ROOT
rm -rf $CGROUP_ROOT
fi
+
+echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages
--
2.42.0
next prev parent reply other threads:[~2024-01-25 15:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 15:46 [PATCH v3 0/5] selftests/mm: Improve run_vmtests.sh Muhammad Usama Anjum
2024-01-25 15:46 ` [PATCH v3 1/5] selftests/mm: hugetlb_reparenting_test: do not unmount Muhammad Usama Anjum
2024-01-25 15:46 ` [PATCH v3 2/5] selftests/mm: run_vmtests: remove sudo and conform to tap Muhammad Usama Anjum
2024-02-01 12:04 ` Ryan Roberts
2024-02-01 12:24 ` Muhammad Usama Anjum
2024-02-01 12:45 ` Ryan Roberts
2024-01-25 15:46 ` Muhammad Usama Anjum [this message]
2024-01-25 15:46 ` [PATCH v3 4/5] selftests/mm: protection_keys: save/restore nr_hugepages settings Muhammad Usama Anjum
2024-03-13 14:58 ` Joey Gouly
2024-03-13 18:12 ` Muhammad Usama Anjum
2024-03-14 9:31 ` Joey Gouly
2024-01-25 15:46 ` [PATCH v3 5/5] selftests/mm: run_vmtests.sh: add missing tests Muhammad Usama Anjum
2024-02-01 12:11 ` Ryan Roberts
2024-02-01 12:26 ` Muhammad Usama Anjum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240125154608.720072-4-usama.anjum@collabora.com \
--to=usama.anjum@collabora.com \
--cc=akpm@linux-foundation.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox