[PATCH blktests v0] nvme/029: reserve hugepages for lager allocations

Daniel Wagner dwagner at suse.de
Tue Feb 20 00:13:27 PST 2024


The test is issuing larger IO workload. This depends on being able to
allocate larger chucks of linear memory. nvme-cli used to use libhugetbl
to automatically allocate the HugeTBL pool. Though nvme-cli dropped the
dependency on the library, thus the test needs to provision the system
accordingly.

Reported-by: Yi Zhang <yi.zhang at redhat.com>
Tested-by: Yi Zhang <yi.zhang at redhat.com>
Signed-off-by: Daniel Wagner <dwagner at suse.de>
---
 tests/nvme/029 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/nvme/029 b/tests/nvme/029
index db6e8b91f707..7833fd29e235 100755
--- a/tests/nvme/029
+++ b/tests/nvme/029
@@ -54,6 +54,7 @@ test() {
 	_setup_nvmet
 
 	local nvmedev
+	local reset_nr_hugepages=false
 
 	_nvmet_target_setup
 
@@ -62,6 +63,11 @@ test() {
 	nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
 	_check_uuid "${nvmedev}"
 
+	if [[ "$(cat /proc/sys/vm/nr_hugepages)" -eq 0 ]]; then
+		echo 20 > /proc/sys/vm/nr_hugepages
+		reset_nr_hugepages=true
+	fi
+
 	local dev="/dev/${nvmedev}n1"
 	test_user_io "$dev" 1 512 > "$FULL" 2>&1 || echo FAIL
 	test_user_io "$dev" 1 511 > "$FULL" 2>&1 || echo FAIL
@@ -70,6 +76,10 @@ test() {
 	test_user_io "$dev" 511 1023 > "$FULL" 2>&1 || echo FAIL
 	test_user_io "$dev" 511 1025 > "$FULL" 2>&1 || echo FAIL
 
+	if [[ ${reset_nr_hugepages} = true ]]; then
+		echo 0 > /proc/sys/vm/nr_hugepages
+	fi
+
 	_nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1
 
 	_nvmet_target_cleanup
-- 
2.43.1




More information about the Linux-nvme mailing list