All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: <linux-kernel@vger.kernel.org>
Cc: "Roger Pau Monne" <roger.pau@citrix.com>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"Jens Axboe" <axboe@kernel.dk>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"SeongJae Park" <sjpark@amazon.de>,
	xen-devel@lists.xenproject.org, linux-block@vger.kernel.org,
	"J . Roeleveld" <joost@antarean.org>,
	"Jürgen Groß" <jgross@suse.com>
Subject: [PATCH 2/2] xen/blkback: turn the cache purge percent into a parameter
Date: Thu, 15 Oct 2020 16:24:16 +0200	[thread overview]
Message-ID: <20201015142416.70294-3-roger.pau@citrix.com> (raw)
In-Reply-To: <20201015142416.70294-1-roger.pau@citrix.com>

Assume that reads and writes to the variable will be atomic. The worse
that could happen is that one of the purges removes a partially
written percentage of grants, but the cache itself will recover.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: SeongJae Park <sjpark@amazon.de>
Cc: xen-devel@lists.xenproject.org
Cc: linux-block@vger.kernel.org
Cc: J. Roeleveld <joost@antarean.org>
Cc: Jürgen Groß <jgross@suse.com>
---
 Documentation/ABI/testing/sysfs-driver-xen-blkback | 9 +++++++++
 drivers/block/xen-blkback/blkback.c                | 7 +++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkback b/Documentation/ABI/testing/sysfs-driver-xen-blkback
index 776f25d335ca..7de791ad61f9 100644
--- a/Documentation/ABI/testing/sysfs-driver-xen-blkback
+++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback
@@ -45,3 +45,12 @@ Description:
                 to be executed periodically. This parameter controls the time
                 interval between consecutive executions of the purge mechanism
                 is set in ms.
+
+What:           /sys/module/xen_blkback/parameters/lru_percent_clean
+Date:           October 2020
+KernelVersion:  5.10
+Contact:        Roger Pau Monné <roger.pau@citrix.com>
+Description:
+                When the persistent grants list is full we will remove unused
+                grants from the list. The percent number of grants to be
+                removed at each LRU execution.
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 6ad9b76fdb2b..772852d45a5a 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -127,7 +127,10 @@ MODULE_PARM_DESC(lru_internval,
  * from the list. The percent number of grants to be removed at each LRU
  * execution.
  */
-#define LRU_PERCENT_CLEAN 5
+static unsigned int lru_percent_clean = 5;
+module_param_named(lru_percent_clean, lru_percent_clean, uint, 0644);
+MODULE_PARM_DESC(lru_percent_clean,
+		 "Percentage of persistent grants to remove from the cache when full");
 
 /* Run-time switchable: /sys/module/blkback/parameters/ */
 static unsigned int log_stats;
@@ -404,7 +407,7 @@ static void purge_persistent_gnt(struct xen_blkif_ring *ring)
 	    !ring->blkif->vbd.overflow_max_grants)) {
 		num_clean = 0;
 	} else {
-		num_clean = (max_pgrants / 100) * LRU_PERCENT_CLEAN;
+		num_clean = (max_pgrants / 100) * lru_percent_clean;
 		num_clean = ring->persistent_gnt_c - max_pgrants + num_clean;
 		num_clean = min(ring->persistent_gnt_c, num_clean);
 		pr_debug("Going to purge at least %u persistent grants\n",
-- 
2.28.0


  parent reply	other threads:[~2020-10-15 14:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 14:24 [PATCH 0/2] xen/blkback: add LRU purge parameters Roger Pau Monne
2020-10-15 14:24 ` [PATCH 1/2] xen/blkback: turn the cache purge LRU interval into a parameter Roger Pau Monne
2020-10-15 14:30   ` Jürgen Groß
2020-10-15 15:08   ` SeongJae Park
2020-10-15 14:24 ` Roger Pau Monne [this message]
2020-10-15 14:37   ` [PATCH 2/2] xen/blkback: turn the cache purge percent " Jürgen Groß
2020-10-15 14:44     ` Roger Pau Monné

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=20201015142416.70294-3-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=axboe@kernel.dk \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=joost@antarean.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sjpark@amazon.de \
    --cc=xen-devel@lists.xenproject.org \
    /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.