All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Konopko <igor.j.konopko@intel.com>
To: mb@lightnvm.io, javier@javigon.com, hans.holmberg@cnexlabs.com
Cc: linux-block@vger.kernel.org, igor.j.konopko@intel.com
Subject: [PATCH v2 5/8] lightnvm: pblk: Cleanly fail when there is not enough memory
Date: Tue,  5 Mar 2019 14:51:17 +0100	[thread overview]
Message-ID: <20190305135120.29284-6-igor.j.konopko@intel.com> (raw)
In-Reply-To: <20190305135120.29284-1-igor.j.konopko@intel.com>

L2P table can be huge in many cases, since it typically requires 1GB
of DRAM for 1TB of drive. When there is not enough memory available,
OOM killer turns on and kills random processes, which can be very
annoying for users.

This patch changes the flag for L2P table allocation on order to handle
this situation in more user friendly way.

GFP_KERNEL and __GPF_HIGHMEM are default flags used in parameterless
vmalloc() calls, so they are also keeped in that patch. Additionally
__GFP_NOWARN flag is added in order to hide very long dmesg warn in
case of the allocation failures. The most important flag introduced
in that patch is __GFP_RETRY_MAYFAIL, which would cause allocator
to try use free memory and if not available to drop caches, but not
to run OOM killer.

Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
Reviewed-by: Javier González <javier@javigon.com>
---
 drivers/lightnvm/pblk-init.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index f4b6d8f2..97b4c6e 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -164,9 +164,14 @@ static int pblk_l2p_init(struct pblk *pblk, bool factory_init)
 	int ret = 0;
 
 	map_size = pblk_trans_map_size(pblk);
-	pblk->trans_map = vmalloc(map_size);
-	if (!pblk->trans_map)
+	pblk->trans_map = __vmalloc(map_size, GFP_KERNEL | __GFP_NOWARN
+					| __GFP_RETRY_MAYFAIL | __GFP_HIGHMEM,
+					PAGE_KERNEL);
+	if (!pblk->trans_map) {
+		pblk_err(pblk, "failed to allocate L2P (need %ld of memory)\n",
+				map_size);
 		return -ENOMEM;
+	}
 
 	pblk_ppa_set_empty(&ppa);
 
-- 
2.9.5


  parent reply	other threads:[~2019-03-05 13:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 13:51 [PATCH v2 0/8] lightnvm: bugfixes and improvements Igor Konopko
2019-03-05 13:51 ` [PATCH v2 1/8] lightnvm: pblk: Gracefully handle GC vmalloc fail Igor Konopko
2019-03-06 14:09   ` Hans Holmberg
2019-03-05 13:51 ` [PATCH v2 2/8] lightnvm: pblk: Fix put line back behaviour Igor Konopko
2019-03-05 13:51 ` [PATCH v2 3/8] lightnvm: pblk: Count all read errors in stats Igor Konopko
2019-03-06  7:28   ` Javier González
2019-03-06 14:19     ` Hans Holmberg
2019-03-06 14:22       ` Igor Konopko
2019-03-05 13:51 ` [PATCH v2 4/8] lightnvm: pblk: Ensure that erase is chunk aligned Igor Konopko
2019-03-06  7:28   ` Javier González
2019-03-06 14:20   ` Hans Holmberg
2019-03-05 13:51 ` Igor Konopko [this message]
2019-03-06 14:20   ` [PATCH v2 5/8] lightnvm: pblk: Cleanly fail when there is not enough memory Hans Holmberg
2019-03-05 13:51 ` [PATCH v2 6/8] lightnvm: pblk: Set proper read stutus in bio Igor Konopko
2019-03-06  8:00   ` Javier González
2019-03-06 14:23   ` Hans Holmberg
2019-03-05 13:51 ` [PATCH v2 7/8] lightnvm: pblk: warn about opened chunk on factory init Igor Konopko
2019-03-06  7:43   ` Javier González
2019-03-06 14:27   ` Hans Holmberg
2019-03-06 14:31     ` Igor Konopko
2019-03-05 13:51 ` [PATCH v2 8/8] lightnvm: Inherit mdts from the parent nvme device Igor Konopko
2019-03-05 14:34   ` Matias Bjørling
2019-03-06  7:44     ` Javier González
2019-03-06 14:29       ` Hans Holmberg
2019-03-09 16:56 ` [PATCH v2 0/8] lightnvm: bugfixes and improvements Matias Bjørling

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=20190305135120.29284-6-igor.j.konopko@intel.com \
    --to=igor.j.konopko@intel.com \
    --cc=hans.holmberg@cnexlabs.com \
    --cc=javier@javigon.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mb@lightnvm.io \
    /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.