From patchwork Fri Jun 1 14:41:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443653 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 9644D602BD for ; Fri, 1 Jun 2018 14:45:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 879B12860A for ; Fri, 1 Jun 2018 14:45:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C71E28944; Fri, 1 Jun 2018 14:45:57 +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 112A32860A for ; Fri, 1 Jun 2018 14:45:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbeFAOp4 (ORCPT ); Fri, 1 Jun 2018 10:45:56 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34634 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752132AbeFAOoC (ORCPT ); Fri, 1 Jun 2018 10:44:02 -0400 Received: by mail-lf0-f68.google.com with SMTP id o9-v6so15205381lfk.1 for ; Fri, 01 Jun 2018 07:44:01 -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=unAH6B8FaXT5KZkSAAjPbGoPsgx71jT2mPs1GSJhLyc=; b=pOOg4D5/niTv0+8HlHboFrj8KlF0QtYi1gdWnPhUqQsllPZJjWrJdwsypoQc/l2VMu rvAfWvTPL+pJ2a5qzJhj2HbBVPi/cBTBklR/a0iGKUAE9ke3/yJ2e7qd6hPGo8wxMRZg vG9yslIrEECNP9ikAed356mz27Xgyw2jK0p+z0EehxGSVx5iYNF246fpZUWeUW8kuzUC z1tWHU/fbLZHZxR/n2oZnSJdyqyaAchP6+eqrPE+a3iEV4it6f/nVw1r4cwTYaBJQvBc zDUygMIImiq4iuAxtn8qZMKCw3JnfjN6dXNrs9rPXfVgXfZ8/K6rBiTtjFVM6u9SBjGb 1xqQ== 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=unAH6B8FaXT5KZkSAAjPbGoPsgx71jT2mPs1GSJhLyc=; b=tTv61/ANbFKWqWGnU5ZKWG87zcCEkj3vWbFum41n/T/+ZRB4E6qzuUFlOBnCQE758m uDqlwgvG6k9OyYlPppJPbsSAWCnRD5CYT6VuECqHdj6xGnGigQa7yBlIEfiOFCJcPPyK IIUPxW0+Bj+u1Rtx6wjb6vf9oxmh4sE9c5hGCFZw/9Iqpxwku/HH27rrcRbFD5n7wyJh /oBGq+g3aOtiYZX/vmOO8ewZH6fYSKDkAiZ3q/E/EDcRoI6zufbHWHxuQiU7f29MKaTY eRmW+9w2q+wr7QHhub4ALweyXsGuaK6WyyVU/MWDwdSSJ7WyXHV2ogIfcfxbWx63uPIm deWw== X-Gm-Message-State: ALKqPwc+HRk17udkpdp66Z+zHDxZ03GmAjS8nWdwMc0x9wMzPF0fb785 fBlrrwLs8OcjaGcxMs5v014HLA== X-Google-Smtp-Source: ADUXVKJVulGE1kLzYD04UyE9ijRt8BSJ82uUs75oTMvF/Rj7CWRhrmKaHKzSU7+3jpLT5iyJUMOgwA== X-Received: by 2002:a19:ea1b:: with SMTP id i27-v6mr6796289lfh.98.1527864240624; Fri, 01 Jun 2018 07:44:00 -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 e65-v6sm356488lff.13.2018.06.01.07.43.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 07:43:59 -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 06/10] lightnvm: pblk: add possibility to set write buffer size manually Date: Fri, 1 Jun 2018 16:41:10 +0200 Message-Id: <20180601144114.17490-7-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601144114.17490-1-mb@lightnvm.io> References: <20180601144114.17490-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 783887b891b7..ce561f5d48ce 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)