[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b7da9e1-6c59-5b8d-52aa-6293568613d1@suse.com>
Date: Thu, 15 Oct 2020 16:37:52 +0200
From: Jürgen Groß <jgross@...e.com>
To: Roger Pau Monne <roger.pau@...rix.com>,
linux-kernel@...r.kernel.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Jens Axboe <axboe@...nel.dk>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
SeongJae Park <sjpark@...zon.de>,
xen-devel@...ts.xenproject.org, linux-block@...r.kernel.org,
"J . Roeleveld" <joost@...arean.org>
Subject: Re: [PATCH 2/2] xen/blkback: turn the cache purge percent into a
parameter
On 15.10.20 16:24, Roger Pau Monne wrote:
> 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@...rix.com>
> ---
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Cc: Jens Axboe <axboe@...nel.dk>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Cc: SeongJae Park <sjpark@...zon.de>
> Cc: xen-devel@...ts.xenproject.org
> Cc: linux-block@...r.kernel.org
> Cc: J. Roeleveld <joost@...arean.org>
> Cc: Jürgen Groß <jgross@...e.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@...rix.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;
Hmm, wouldn't it be better to use (max_grants * lru_percent_clean) / 100
here in order to support max_grants values less than 100?
Juergen
Powered by blists - more mailing lists