Re: [PATCH 2/2] erofs: add sysfs node to control sync decompression strategy
From: Gao Xiang
Date: Mon Nov 08 2021 - 22:16:54 EST
On Tue, Nov 09, 2021 at 10:54:45AM +0800, Huang Jianan via Linux-erofs wrote:
> Although readpage is a synchronous path, there will be no additional
> kworker scheduling overhead in non-atomic contexts. So we can add a
> sysfs node to allow disable sync decompression.
>
> Signed-off-by: Huang Jianan <huangjianan@xxxxxxxx>
> ---
> fs/erofs/internal.h | 2 +-
> fs/erofs/super.c | 2 +-
> fs/erofs/sysfs.c | 6 ++++++
> fs/erofs/zdata.c | 9 ++++-----
> 4 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
> index d0cd712dc222..1ab96878009d 100644
> --- a/fs/erofs/internal.h
> +++ b/fs/erofs/internal.h
> @@ -60,7 +60,7 @@ struct erofs_mount_opts {
> #ifdef CONFIG_EROFS_FS_ZIP
> /* current strategy of how to use managed cache */
> unsigned char cache_strategy;
> - /* strategy of sync decompression (false - auto, true - force on) */
> + /* strategy of sync decompression (false - disable, true - force on) */
Please leave false - auto.
> bool readahead_sync_decompress;
>
> /* threshold for decompression synchronously */
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index abc1da5d1719..26585d865503 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -423,7 +423,7 @@ static void erofs_default_options(struct erofs_fs_context *ctx)
> #ifdef CONFIG_EROFS_FS_ZIP
> ctx->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND;
> ctx->opt.max_sync_decompress_pages = 3;
> - ctx->opt.readahead_sync_decompress = false;
> + ctx->opt.readahead_sync_decompress = true;
Please leave readahead_sync_decompress = false 'auto' by default.
I don't like .readpage() applies async decompression since it's
actually a sync way, otherwise, it will cause more scheduling
overhead, see:
https://lore.kernel.org/r/20201016160443.18685-1-willy@xxxxxxxxxxxxx
https://lore.kernel.org/r/20201102184312.25926-16-willy@xxxxxxxxxxxxx
Thanks,
Gao Xiang