public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	Keith Busch <kbusch@kernel.org>,
	linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	Daniel Wagner <dwagner@suse.de>, Yi Zhang <yi.zhang@redhat.com>
Subject: [PATCH blktests v1] nvme/029: reserve hugepages for lager allocations
Date: Wed, 21 Feb 2024 08:43:53 +0100	[thread overview]
Message-ID: <20240221074353.27646-1-dwagner@suse.de> (raw)

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>
---
 tests/nvme/029 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/nvme/029 b/tests/nvme/029
index db6e8b91f707..a4f0cb1402b1 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,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
-- 
2.43.1


             reply	other threads:[~2024-02-21  7:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  7:43 Daniel Wagner [this message]
2024-02-21  8:16 ` [PATCH blktests v1] nvme/029: reserve hugepages for lager allocations Chaitanya Kulkarni
2024-02-22  2:46 ` Shinichiro Kawasaki

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=20240221074353.27646-1-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=chaitanyak@nvidia.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yi.zhang@redhat.com \
    /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