[PATCH v2] erofs: rename per CPU buffer to global buffer pool and make it configurable

Gao Xiang hsiangkao at linux.alibaba.com
Sat Mar 23 00:03:23 AEDT 2024


Hi Chunhai,

On 2024/3/22 19:48, Chunhai Guo wrote:
> It will cost more time if compressed buffers are allocated on demand for
> low-latency algorithms (like lz4) so EROFS uses per-CPU buffers to keep
> compressed data if in-place decompression is unfulfilled.  While it is kind
> of wasteful of memory for a device with hundreds of CPUs, and only a small
> number of CPUs concurrently decompress most of the time.
> 
> This patch renames it as 'global buffer pool' and makes it configurable.
> This allows two or more CPUs to share a common buffer to reduce memory
> occupation.
> 
> Signed-off-by: Chunhai Guo <guochunhai at vivo.com>
> Suggested-by: Gao Xiang <xiang at kernel.org>
> ---

...

> diff --git a/fs/erofs/utils.c b/fs/erofs/utils.c
> index e146d09151af..7b552bb8c36e 100644
> --- a/fs/erofs/utils.c
> +++ b/fs/erofs/utils.c
> @@ -284,4 +284,152 @@ void erofs_exit_shrinker(void)
>   {
>   	shrinker_free(erofs_shrinker_info);
>   }
> +
> +struct z_erofs_gbuf {
> +	spinlock_t lock;
> +	void *ptr;
> +	struct page **pages;
> +	unsigned int nrpages;
> +};
> +
> +struct z_erofs_gbuf *z_erofs_gbufpool;
> +unsigned int z_erofs_gbuf_count, z_erofs_gbuf_nrpages;

I'd rather to:

static struct z_erofs_gbuf *z_erofs_gbufpool;
static unsigned int z_erofs_gbuf_count, z_erofs_gbuf_nrpages;

You could send out a quick v3 or I could manually modify this
later.

Otherwise it looks good to me,
Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list