All of lore.kernel.org
 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,
	"Igor Konopko" <igor.j.konopko@intel.com>,
	"Matias Bjørling" <mb@lightnvm.io>
Subject: [GIT PULL 03/26] lightnvm: pblk: reduce L2P memory footprint
Date: Sat,  4 May 2019 20:37:48 +0200	[thread overview]
Message-ID: <20190504183811.18725-4-mb@lightnvm.io> (raw)
In-Reply-To: <20190504183811.18725-1-mb@lightnvm.io>

From: Igor Konopko <igor.j.konopko@intel.com>

Currently L2P map size is calculated based on the total number of
available sectors, which is redundant, since it contains mapping for
overprovisioning as well (11% by default).

Change this size to the real capacity and thus reduce the memory
footprint significantly - with default op value it is approx.
110MB of DRAM less for every 1TB of media.

Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
Reviewed-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
---
 drivers/lightnvm/pblk-core.c     | 8 ++++----
 drivers/lightnvm/pblk-init.c     | 7 +++----
 drivers/lightnvm/pblk-read.c     | 2 +-
 drivers/lightnvm/pblk-recovery.c | 2 +-
 drivers/lightnvm/pblk.h          | 1 -
 5 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 6ca868868fee..fac32138291f 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -2023,7 +2023,7 @@ void pblk_update_map(struct pblk *pblk, sector_t lba, struct ppa_addr ppa)
 	struct ppa_addr ppa_l2p;
 
 	/* logic error: lba out-of-bounds. Ignore update */
-	if (!(lba < pblk->rl.nr_secs)) {
+	if (!(lba < pblk->capacity)) {
 		WARN(1, "pblk: corrupted L2P map request\n");
 		return;
 	}
@@ -2063,7 +2063,7 @@ int pblk_update_map_gc(struct pblk *pblk, sector_t lba, struct ppa_addr ppa_new,
 #endif
 
 	/* logic error: lba out-of-bounds. Ignore update */
-	if (!(lba < pblk->rl.nr_secs)) {
+	if (!(lba < pblk->capacity)) {
 		WARN(1, "pblk: corrupted L2P map request\n");
 		return 0;
 	}
@@ -2109,7 +2109,7 @@ void pblk_update_map_dev(struct pblk *pblk, sector_t lba,
 	}
 
 	/* logic error: lba out-of-bounds. Ignore update */
-	if (!(lba < pblk->rl.nr_secs)) {
+	if (!(lba < pblk->capacity)) {
 		WARN(1, "pblk: corrupted L2P map request\n");
 		return;
 	}
@@ -2167,7 +2167,7 @@ void pblk_lookup_l2p_rand(struct pblk *pblk, struct ppa_addr *ppas,
 		lba = lba_list[i];
 		if (lba != ADDR_EMPTY) {
 			/* logic error: lba out-of-bounds. Ignore update */
-			if (!(lba < pblk->rl.nr_secs)) {
+			if (!(lba < pblk->capacity)) {
 				WARN(1, "pblk: corrupted L2P map request\n");
 				continue;
 			}
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 8b643d0bffae..81e8ed4d31ea 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -105,7 +105,7 @@ static size_t pblk_trans_map_size(struct pblk *pblk)
 	if (pblk->addrf_len < 32)
 		entry_size = 4;
 
-	return entry_size * pblk->rl.nr_secs;
+	return entry_size * pblk->capacity;
 }
 
 #ifdef CONFIG_NVM_PBLK_DEBUG
@@ -170,7 +170,7 @@ static int pblk_l2p_init(struct pblk *pblk, bool factory_init)
 
 	pblk_ppa_set_empty(&ppa);
 
-	for (i = 0; i < pblk->rl.nr_secs; i++)
+	for (i = 0; i < pblk->capacity; i++)
 		pblk_trans_map_set(pblk, i, ppa);
 
 	ret = pblk_l2p_recover(pblk, factory_init);
@@ -701,7 +701,6 @@ static int pblk_set_provision(struct pblk *pblk, int nr_free_chks)
 	 * on user capacity consider only provisioned blocks
 	 */
 	pblk->rl.total_blocks = nr_free_chks;
-	pblk->rl.nr_secs = nr_free_chks * geo->clba;
 
 	/* Consider sectors used for metadata */
 	sec_meta = (lm->smeta_sec + lm->emeta_sec[0]) * l_mg->nr_free_lines;
@@ -1284,7 +1283,7 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
 
 	pblk_info(pblk, "luns:%u, lines:%d, secs:%llu, buf entries:%u\n",
 			geo->all_luns, pblk->l_mg.nr_lines,
-			(unsigned long long)pblk->rl.nr_secs,
+			(unsigned long long)pblk->capacity,
 			pblk->rwb.nr_entries);
 
 	wake_up_process(pblk->writer_ts);
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 0b7d5fb4548d..b8eb6bdb983b 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -568,7 +568,7 @@ static int read_rq_gc(struct pblk *pblk, struct nvm_rq *rqd,
 		goto out;
 
 	/* logic error: lba out-of-bounds */
-	if (lba >= pblk->rl.nr_secs) {
+	if (lba >= pblk->capacity) {
 		WARN(1, "pblk: read lba out of bounds\n");
 		goto out;
 	}
diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index d86f580036d3..83b467b5edc7 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -474,7 +474,7 @@ static int pblk_recov_scan_oob(struct pblk *pblk, struct pblk_line *line,
 
 		lba_list[paddr++] = cpu_to_le64(lba);
 
-		if (lba == ADDR_EMPTY || lba > pblk->rl.nr_secs)
+		if (lba == ADDR_EMPTY || lba >= pblk->capacity)
 			continue;
 
 		line->nr_valid_lbas++;
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index ac3ab778e976..58da72dbef45 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -305,7 +305,6 @@ struct pblk_rl {
 
 	struct timer_list u_timer;
 
-	unsigned long long nr_secs;
 	unsigned long total_blocks;
 
 	atomic_t free_blocks;		/* Total number of free blocks (+ OP) */
-- 
2.19.1


  parent reply	other threads:[~2019-05-04 18:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 18:37 [GIT PULL 00/26] lightnvm updates for 5.2 Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 01/26] lightnvm: pblk: line reference fix in GC Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 02/26] lightnvm: pblk: rollback on error during gc read Matias Bjørling
2019-05-04 18:37 ` Matias Bjørling [this message]
2019-05-04 18:37 ` [GIT PULL 04/26] lightnvm: pblk: remove unused smeta_ssec field Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 05/26] lightnvm: pblk: gracefully handle GC vmalloc fail Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 06/26] lightnvm: pblk: fix race during put line Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 07/26] lightnvm: pblk: ensure that erase is chunk aligned Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 08/26] lightnvm: pblk: cleanly fail when there is not enough memory Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 09/26] lightnvm: pblk: set proper read status in bio Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 10/26] lightnvm: Inherit mdts from the parent nvme device Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 11/26] lightnvm: pblk: fix bio leak when bio is split Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 12/26] lightnvm: pblk: set propper line as data_line after gc Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 13/26] lightnvm: prevent race condition on pblk remove Matias Bjørling
2019-05-04 18:37 ` [GIT PULL 14/26] lightnvm: pblk: fix lock order in pblk_rb_tear_down_check Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 15/26] lightnvm: pblk: kick writer on write recovery path Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 16/26] lightnvm: pblk: fix update line wp in OOB recovery Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 17/26] lightnvm: pblk: propagate errors when reading meta Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 18/26] lightnvm: pblk: wait for inflight IOs in recovery Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 19/26] lightnvm: pblk: remove internal IO timeout Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 20/26] lightnvm: pblk: GC error handling Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 21/26] lightnvm: pblk: IO path reorganization Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 22/26] lightnvm: pblk: recover only written metadata Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 23/26] lightnvm: track inflight target creations Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 24/26] lightnvm: do not remove instance under global lock Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 25/26] lightnvm: pblk: simplify partial read path Matias Bjørling
2019-05-04 18:38 ` [GIT PULL 26/26] lightnvm: pblk: use nvm_rq_to_ppa_list() Matias Bjørling
2019-05-06 16:20 ` [GIT PULL 00/26] lightnvm updates for 5.2 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=20190504183811.18725-4-mb@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=axboe@fb.com \
    --cc=igor.j.konopko@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.