From patchwork Mon May 28 08:58:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10430123 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 82358602CC for ; Mon, 28 May 2018 09:02:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 749C528BDB for ; Mon, 28 May 2018 09:02:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6936528BE1; Mon, 28 May 2018 09:02:44 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 C082F28BDB for ; Mon, 28 May 2018 09:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754210AbeE1JCl (ORCPT ); Mon, 28 May 2018 05:02:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37319 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754208AbeE1I7P (ORCPT ); Mon, 28 May 2018 04:59:15 -0400 Received: by mail-wm0-f66.google.com with SMTP id l1-v6so30119928wmb.2 for ; Mon, 28 May 2018 01:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LNqySth4KqJFMNLGd2UT4ptH0DB0Uxms0NW6H997e7E=; b=VbYo8AjNyWis++7N+lHxX3ezHIVBAJtSFvEWM3ZsmDaLT4tkq4nownxRE67Muh9aTC A2bPn38YOc1SUkyQsBUuJPvr2OIct9Uka7KH9TipJWTEgjgXXoNtoZ+T0Bdod6+cdFGu X8e1jC0iox84SsXXOXLYbTnwRbPd1djA1HXYaVUPtWVyrdJohxM4unaJlp/7FhbJYdoQ 8ENv6CPMq36Q/uT98ep8MElCwrQXXA3avj563lrLw501JsrDBS2Ea4YWyUOmUSZI9gtZ XDQNZczJhhyIs08X5SMn/vGTnXTyw7KNnW01Hw0KYVhVdsoBg14zuKf+iwANxCuGIxEz QWdA== 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=LNqySth4KqJFMNLGd2UT4ptH0DB0Uxms0NW6H997e7E=; b=EHxDEkfFpCgqx1SDrSQLHRNHsnX0Y7257F9Ir16Tu8y7bcG4jlGXVDqmwKzSTFFSdC nLeZDPUhCmptND5xAwuLJfu1wpMfFNuUS99Hywfdk6Ba4oSvUgm4nV1BdAUh651yXpxp v20exyi0gPXwH5vXFYh1eFlil6RyMwl0j7p+u8H2x+U1BILCUhiTeHhecPLpKyMgGNEI a3H7YQASwaTlgudQ37jImesujbmNFxCavXPyMrXzReHVPzpiH/mo5YhbCuyjsDCbZScW tvex9yTmQfUcmCWuCxnuTAjqcFq9OGi5Y12rhfbZIOXdr4U4n9yoZmBJBYIfP7LPBqWF g+1w== X-Gm-Message-State: ALKqPwecl/LJ1iNWnguAKXrpam0KB/GIIYm426oDvHTqMa7S3CP+ze/1 oj3H2L7+RmXmtoGZcnaa54KRKQ== X-Google-Smtp-Source: ADUXVKKwmsJV8WHOXs2UQxRYU8DTzyWlfVGHAVEQzbSeTcoTwNJwmuHRPufPmI+CdmUY+uWyBjhcpQ== X-Received: by 2002:a2e:92ca:: with SMTP id k10-v6mr7677389ljh.1.1527497954182; Mon, 28 May 2018 01:59:14 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id u2-v6sm5777848lji.4.2018.05.28.01.59.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 01:59:13 -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, Marcin Dziegielewski , Igor Konopko , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 19/20] lightnvm: pblk: add possibility to set write buffer size manually Date: Mon, 28 May 2018 10:58:40 +0200 Message-Id: <20180528085841.26684-20-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180528085841.26684-1-mb@lightnvm.io> References: <20180528085841.26684-1-mb@lightnvm.io> 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: Marcin Dziegielewski In some cases, users can want set write buffer size manually, e.g. to adjust it to specific workload. This patch provides the possibility to set write buffer size via module parameter feature. Signed-off-by: Marcin Dziegielewski Signed-off-by: Igor Konopko Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-init.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 0f277744266b..25aa1e73984f 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -20,6 +20,11 @@ #include "pblk.h" +unsigned int write_buffer_size; + +module_param(write_buffer_size, uint, 0644); +MODULE_PARM_DESC(write_buffer_size, "number of entries in a write buffer"); + static struct kmem_cache *pblk_ws_cache, *pblk_rec_cache, *pblk_g_rq_cache, *pblk_w_rq_cache; static DECLARE_RWSEM(pblk_lock); @@ -172,10 +177,15 @@ static int pblk_rwb_init(struct pblk *pblk) struct nvm_tgt_dev *dev = pblk->dev; struct nvm_geo *geo = &dev->geo; struct pblk_rb_entry *entries; - unsigned long nr_entries; + unsigned long nr_entries, buffer_size; unsigned int power_size, power_seg_sz; - nr_entries = pblk_rb_calculate_size(pblk->pgs_in_buffer); + if (write_buffer_size && (write_buffer_size > pblk->pgs_in_buffer)) + buffer_size = write_buffer_size; + else + buffer_size = pblk->pgs_in_buffer; + + nr_entries = pblk_rb_calculate_size(buffer_size); entries = vzalloc(nr_entries * sizeof(struct pblk_rb_entry)); if (!entries)