From patchwork Fri Oct 13 12:46:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 10004631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AF60760360 for ; Fri, 13 Oct 2017 13:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A182429090 for ; Fri, 13 Oct 2017 13:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 961F429080; Fri, 13 Oct 2017 13:00:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AEFE29096 for ; Fri, 13 Oct 2017 13:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758284AbdJMM76 (ORCPT ); Fri, 13 Oct 2017 08:59:58 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51334 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758171AbdJMMrZ (ORCPT ); Fri, 13 Oct 2017 08:47:25 -0400 Received: by mail-wm0-f66.google.com with SMTP id f4so21574719wme.0 for ; Fri, 13 Oct 2017 05:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LDMpT3u0ddcXhCz2wR8CWnc/R+D3Dm5GIWZtLIv2RVc=; b=qlSZh4iHHc/ZtadUIJbtt7toP5GK2J1epaWKObmGpdyqWDTGHHxeMbVecT8jgK0xGS h7tb89tNxZBr22EOAn6PAxLIZ6SNUi9dr9LWCvncthplJDZiT6vFdln2zQFU2gmf7Ax2 4zgKogXit71uCAvllAIrZ7JCmeH9XnPVEPfWs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LDMpT3u0ddcXhCz2wR8CWnc/R+D3Dm5GIWZtLIv2RVc=; b=lhhMV8oeVU04ElkgnxJkD5bcCxKjdq6P5O7Zilb9c+U6ysNkKhHEBWPatzWbxYkjj/ rfVg2YYuVx603sBTpUn74mgetDdAKFa/7fC3frKtbnt7IQqOWGFIG3t10ke1qdjOEcRZ WBIGxful47808btoizuU167Y1QIvXw0iCgBKbSUjeXOOYNOvB6WKVvYpXXsBc6larZV2 xZ23LkgO3f/0Wh1SlDSCDznTIH0JziLrZtBOdfXArZp82lozwtSmJINz1JaYLpUytye2 cN4+ogzNCVFTl55+ysEF4Y1RREfMLH95v2RcaGcA8CzTWwK9ZTswvcsfi0dZ0ji7LBHy 6sYw== X-Gm-Message-State: AMCzsaUJjXXYuK7cwL63t9MG6Myw86XR2xLqzhNV3N5vvrN5Yo19oHNe OwQiVunzwLfktDc1vIvP7Ip3CA== X-Google-Smtp-Source: AOwi7QDHlC5xnmyPnkqL/4n+LiPHPAAXfrX6aK6mizYUjK6btIZo7+6jgoxjZqVFpqph6lzjAzHXxQ== X-Received: by 10.80.131.230 with SMTP id 93mr2021814edi.12.1507898844524; Fri, 13 Oct 2017 05:47:24 -0700 (PDT) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id p91sm735012edp.69.2017.10.13.05.47.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 05:47:23 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 19/58] lightnvm: pblk: decouple read/erase mempools Date: Fri, 13 Oct 2017 14:46:08 +0200 Message-Id: <20171013124647.32668-20-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171013124647.32668-1-m@bjorling.me> References: <20171013124647.32668-1-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González Since read and erase paths offer different guarantees for inflight I/Os, separate the mempools to set the right min_nr for each on creation. Reported-by: Jens Axboe Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-core.c | 8 ++++---- drivers/lightnvm/pblk-init.c | 22 +++++++++++++++------- drivers/lightnvm/pblk.h | 5 +++-- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index b925322..0c22e5c 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -64,7 +64,7 @@ static void pblk_end_io_erase(struct nvm_rq *rqd) struct pblk *pblk = rqd->private; __pblk_end_io_erase(pblk, rqd); - mempool_free(rqd, pblk->g_rq_pool); + mempool_free(rqd, pblk->e_rq_pool); } void __pblk_map_invalidate(struct pblk *pblk, struct pblk_line *line, @@ -161,7 +161,7 @@ struct nvm_rq *pblk_alloc_rqd(struct pblk *pblk, int rw) pool = pblk->w_rq_pool; rq_size = pblk_w_rq_size; } else { - pool = pblk->g_rq_pool; + pool = pblk->r_rq_pool; rq_size = pblk_g_rq_size; } @@ -178,7 +178,7 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int rw) if (rw == WRITE) pool = pblk->w_rq_pool; else - pool = pblk->g_rq_pool; + pool = pblk->r_rq_pool; mempool_free(rqd, pool); } @@ -1479,7 +1479,7 @@ int pblk_blk_erase_async(struct pblk *pblk, struct ppa_addr ppa) struct nvm_rq *rqd; int err; - rqd = mempool_alloc(pblk->g_rq_pool, GFP_KERNEL); + rqd = mempool_alloc(pblk->e_rq_pool, GFP_KERNEL); memset(rqd, 0, pblk_g_rq_size); pblk_setup_e_rq(pblk, rqd, ppa); diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 3405522..2f8d3f9 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -261,15 +261,20 @@ static int pblk_core_init(struct pblk *pblk) if (!pblk->rec_pool) goto free_gen_ws_pool; - pblk->g_rq_pool = mempool_create_slab_pool(PBLK_READ_REQ_POOL_SIZE, + pblk->r_rq_pool = mempool_create_slab_pool(geo->nr_luns, pblk_g_rq_cache); - if (!pblk->g_rq_pool) + if (!pblk->r_rq_pool) goto free_rec_pool; - pblk->w_rq_pool = mempool_create_slab_pool(geo->nr_luns * 2, + pblk->e_rq_pool = mempool_create_slab_pool(geo->nr_luns, + pblk_g_rq_cache); + if (!pblk->e_rq_pool) + goto free_r_rq_pool; + + pblk->w_rq_pool = mempool_create_slab_pool(geo->nr_luns, pblk_w_rq_cache); if (!pblk->w_rq_pool) - goto free_g_rq_pool; + goto free_e_rq_pool; pblk->line_meta_pool = mempool_create_slab_pool(PBLK_META_POOL_SIZE, @@ -304,8 +309,10 @@ static int pblk_core_init(struct pblk *pblk) mempool_destroy(pblk->line_meta_pool); free_w_rq_pool: mempool_destroy(pblk->w_rq_pool); -free_g_rq_pool: - mempool_destroy(pblk->g_rq_pool); +free_e_rq_pool: + mempool_destroy(pblk->e_rq_pool); +free_r_rq_pool: + mempool_destroy(pblk->r_rq_pool); free_rec_pool: mempool_destroy(pblk->rec_pool); free_gen_ws_pool: @@ -326,7 +333,8 @@ static void pblk_core_free(struct pblk *pblk) mempool_destroy(pblk->page_bio_pool); mempool_destroy(pblk->gen_ws_pool); mempool_destroy(pblk->rec_pool); - mempool_destroy(pblk->g_rq_pool); + mempool_destroy(pblk->r_rq_pool); + mempool_destroy(pblk->e_rq_pool); mempool_destroy(pblk->w_rq_pool); mempool_destroy(pblk->line_meta_pool); diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index efaa781..419e1b7 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -41,7 +41,6 @@ #define PBLK_MAX_REQ_ADDRS_PW (6) #define PBLK_META_POOL_SIZE (128) -#define PBLK_READ_REQ_POOL_SIZE (1024) #define PBLK_NR_CLOSE_JOBS (4) @@ -60,6 +59,7 @@ #define ERASE 2 /* READ = 0, WRITE = 1 */ +/* Static pool sizes */ #define PBLK_GEN_WS_POOL_SIZE (2) enum { @@ -624,8 +624,9 @@ struct pblk { mempool_t *page_bio_pool; mempool_t *gen_ws_pool; mempool_t *rec_pool; - mempool_t *g_rq_pool; + mempool_t *r_rq_pool; mempool_t *w_rq_pool; + mempool_t *e_rq_pool; mempool_t *line_meta_pool; struct workqueue_struct *close_wq;