]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
nvme/029: reserve hugepages for lager allocations
authorDaniel Wagner <dwagner@suse.de>
Wed, 21 Feb 2024 07:43:53 +0000 (08:43 +0100)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 22 Feb 2024 01:02:39 +0000 (10:02 +0900)
The test is issuing larger IO workload. This depends on being able to
allocate larger chunks of linear memory. nvme-cli used to use libhugetlb
to automatically allocate the HugeTLB pool. Though nvme-cli dropped the
dependency on the library, thus the test should try to provision the
system accordingly.

Link: https://github.com/linux-nvme/nvme-cli/issues/2218
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
tests/nvme/029

index db6e8b91f7077f47705522197adcaae2c8b2bcbb..a4f0cb1402b14453d5141aa1e87f040f2718d2b0 100755 (executable)
@@ -54,6 +54,7 @@ test() {
        _setup_nvmet
 
        local nvmedev
+       local reset_nr_hugepages=false
 
        _nvmet_target_setup
 
@@ -62,6 +63,15 @@ test() {
        nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
        _check_uuid "${nvmedev}"
 
+       # nvme-cli may fail to allocate linear memory for rather large IO buffers.
+       # Increase nr_hugepages to allow nvme-cli to try the linear memory allocation
+       # from HugeTLB pool.
+       if [[  -r /proc/sys/vm/nr_hugepages &&
+                      "$(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 +80,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