Skip to content

Commit

Permalink
nvme/029: reserve hugepages for lager allocations
Browse files Browse the repository at this point in the history
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: linux-nvme/nvme-cli#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>
  • Loading branch information
igaw authored and kawasaki committed Feb 22, 2024
1 parent ac3d8d0 commit d60e466
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/nvme/029
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ test() {
_setup_nvmet

local nvmedev
local reset_nr_hugepages=false

_nvmet_target_setup

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d60e466

Please sign in to comment.