mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@lightnvm.io>
To: axboe@fb.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	bart.vanassche@wdc.com, hans.holmberg@cnexlabs.com,
	javier@cnexlabs.com, hlitz@ucsc.edu, igor.j.konopko@intel.com,
	marcin.dziegielewski@intel.com,
	"Matias Bjørling" <mb@lightnvm.io>
Subject: [GIT PULL 06/10] lightnvm: limit get chunk meta request size
Date: Fri, 13 Jul 2018 10:48:41 +0200	[thread overview]
Message-ID: <20180713084845.19511-7-mb@lightnvm.io> (raw)
In-Reply-To: <20180713084845.19511-1-mb@lightnvm.io>

For devices that does not specify a limit on its transfer size, the
get_chk_meta command may send down a single I/O retrieving the full
chunk metadata table. Resulting in large 2-4MB I/O requests. Instead,
split up the I/Os to a maximum of 256KB and issue them separately to
reduce memory requirements.

Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Reviewed-by: Javier González <javier@cnexlabs.com>
---
 drivers/nvme/host/lightnvm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index a76db8820f1c..d9e4cccd5b66 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -583,7 +583,13 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev,
 	struct ppa_addr ppa;
 	size_t left = nchks * sizeof(struct nvme_nvm_chk_meta);
 	size_t log_pos, offset, len;
-	int ret, i;
+	int ret, i, max_len;
+
+	/*
+	 * limit requests to maximum 256K to avoid issuing arbitrary large
+	 * requests when the device does not specific a maximum transfer size.
+	 */
+	max_len = min_t(unsigned int, ctrl->max_hw_sectors << 9, 256 * 1024);
 
 	/* Normalize lba address space to obtain log offset */
 	ppa.ppa = slba;
@@ -596,7 +602,7 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev,
 	offset = log_pos * sizeof(struct nvme_nvm_chk_meta);
 
 	while (left) {
-		len = min_t(unsigned int, left, ctrl->max_hw_sectors << 9);
+		len = min_t(unsigned int, left, max_len);
 
 		ret = nvme_get_log_ext(ctrl, ns, NVME_NVM_LOG_REPORT_CHUNK,
 				dev_meta, len, offset);
-- 
2.11.0


  parent reply	other threads:[~2018-07-13  8:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13  8:48 [GIT PULL 00/10] lightnvm updates for 4.19 Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 01/10] lightnvm: pblk: handle case when mw_cunits equals to 0 Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 02/10] lightnvm: move NVM_DEBUG to pblk Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 03/10] lightnvm: pblk: enable line minor version detection Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 04/10] lightnvm: Remove redundant rq->__data_len initialization Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 05/10] lightnvm: pblk: fix read_bitmap for 32bit archs Matias Bjørling
2018-07-13  8:48 ` Matias Bjørling [this message]
2018-07-13  8:48 ` [GIT PULL 07/10] lightnvm: pblk: expose generic disk name on pr_* msgs Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 08/10] lightnvm: pblk: mark expected switch fall-through Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 09/10] lightnvm: pblk: add asynchronous partial read Matias Bjørling
2018-07-13  8:48 ` [GIT PULL 10/10] lightnvm: pblk: assume that chunks are closed on 1.2 devices Matias Bjørling
2018-07-13 14:15 ` [GIT PULL 00/10] lightnvm updates for 4.19 Jens Axboe

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=20180713084845.19511-7-mb@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=axboe@fb.com \
    --cc=bart.vanassche@wdc.com \
    --cc=hans.holmberg@cnexlabs.com \
    --cc=hlitz@ucsc.edu \
    --cc=igor.j.konopko@intel.com \
    --cc=javier@cnexlabs.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.dziegielewski@intel.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

all inboxes | Powered by JetHome®