From patchwork Fri Jun 1 13:04:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443319 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 1C5AC601D3 for ; Fri, 1 Jun 2018 13:05:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B5BB28D7B for ; Fri, 1 Jun 2018 13:05:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3B2E28D90; Fri, 1 Jun 2018 13:05:24 +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 8F9F3289AE for ; Fri, 1 Jun 2018 13:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751378AbeFANFV (ORCPT ); Fri, 1 Jun 2018 09:05:21 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:44409 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbeFANFQ (ORCPT ); Fri, 1 Jun 2018 09:05:16 -0400 Received: by mail-lf0-f68.google.com with SMTP id 36-v6so12794091lfr.11 for ; Fri, 01 Jun 2018 06:05:15 -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=sudVJkqJPXscYFZ7bqb5ExoF8Dw+Uy5oZFp6TSSxtZI=; b=r1hndv2TmNSJJZs+mCleMTeCrk3YI8SVfwnbsfbqyibWOauOBB5Kef7NtuiYHUW51j iTeN5JMWpPQvxET+RTU24DtvxhXTGvW9XpxYmZ1jUkEmAu5lfinldTGSZAr8Kf7cRmQ7 +gh777V5NfDph6kWfwnvQQJ0eZRnG35xWZ/+p5NBcUqaG+Lhc6RvMQWCvUliRYN5tzOZ UwuWOPJEh1acZewF6qc3PfZOnGZULQypzXZqOKRNU4avTMTx4gHO3HOwN5cOV3ib+pNY 8lhWwYK7zFQUf1CYrWdoTN8G1zKQS2kdQJcoaboXNFzNMShMxRfmNDrEIDYtP+dQfQmh Srjg== 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=sudVJkqJPXscYFZ7bqb5ExoF8Dw+Uy5oZFp6TSSxtZI=; b=b/QkIWs3WZU8eqVQpV9zygomPe8szMjXoBDqv5D25LtgEXQ4/XtceOPusNYdtNZNH/ bAwSq+ImNMWF0WUMeJQs+YVmPXk/l8zmibZVRAUQ+I5/CBQQ4rMR4ul35QTkkmGnqdlH z6turiz4mZy7xsa30TsPMNG/6CTS4w3NH/49nxXxOz2kHcvbKayA2PrxwxWy129Z6ZVY uKPGJYzR5bPXOqfeVEqEvYm6Jv8jyE/K83rJVDQqID81pmo9QoA27LNTFGCFeaVWnuCL 8dt/6ETZwJ8lrx02IjaLPuDrdiR5tRQe7kxhILIDFnVfOn2ekb29dsK1PQS13+BWLbtV gVZA== X-Gm-Message-State: ALKqPwf2V7yyPxoNB7pJsc1eiZTVwd54hqqM7fIAlOJE4jMOkxBDWPsI fTcXMNYjcy+SLLQtOkLW/yW4ig== X-Google-Smtp-Source: ADUXVKI/kGLSBzhHWlkf/VwClIMOyqiJojJUYZwlYVUnriyolBU8RtUlXSYjPvkKgFsJxgKfFpYK3g== X-Received: by 2002:a2e:5559:: with SMTP id j86-v6mr8463412ljb.147.1527858315190; Fri, 01 Jun 2018 06:05:15 -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 g5-v6sm303161lje.21.2018.06.01.06.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 06:05:14 -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, javier@cnexlabs.com, igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 17/18] lightnvm: pblk: add possibility to set write buffer size manually Date: Fri, 1 Jun 2018 15:04:31 +0200 Message-Id: <20180601130432.30866-18-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601130432.30866-1-mb@lightnvm.io> References: <20180601130432.30866-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 d65d2f972ccf..c890493e0e49 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)