From: Gao Xiang <hsiangkao@redhat.com>
To: Huang Jianan <huangjianan@oppo.com>
Cc: zhangshiming@oppo.com, guoweichao@oppo.com,
linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] erofs: support adjust lz4 history window size
Date: Tue, 23 Feb 2021 15:44:18 +0800 [thread overview]
Message-ID: <20210223074418.GA1269766@xiangao.remote.csb> (raw)
In-Reply-To: <20210223073119.69232-1-huangjianan@oppo.com>
On Tue, Feb 23, 2021 at 03:31:19PM +0800, Huang Jianan via Linux-erofs wrote:
> lz4 uses LZ4_DISTANCE_MAX to record history preservation. When
> using rolling decompression, a block with a higher compression
> ratio will cause a larger memory allocation (up to 64k). It may
> cause a large resource burden in extreme cases on devices with
> small memory and a large number of concurrent IOs. So appropriately
> reducing this value can improve performance.
>
> Decreasing this value will reduce the compression ratio (except
> when input_size <LZ4_DISTANCE_MAX). But considering that erofs
> currently only supports 4k output, reducing this value will not
> significantly reduce the compression benefits.
>
> The maximum value of LZ4_DISTANCE_MAX defined by lz4 is 64k, and
> we can only reduce this value. For the old kernel, it just can't
> reduce the memory allocation during rolling decompression without
> affecting the decompression result.
>
> Signed-off-by: Huang Jianan <huangjianan@oppo.com>
> Signed-off-by: Guo Weichao <guoweichao@oppo.com>
> ---
>
> change since v2:
> - use z_erofs_load_lz4_config to calculate lz4_distance_pages
> - add description about the compatibility of the old kernel version
> - drop useless comment
>
> fs/erofs/decompressor.c | 22 ++++++++++++++++++----
> fs/erofs/erofs_fs.h | 3 ++-
> fs/erofs/internal.h | 7 +++++++
> fs/erofs/super.c | 2 ++
> 4 files changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
> index 1cb1ffd10569..0bb7903e3f9b 100644
> --- a/fs/erofs/decompressor.c
> +++ b/fs/erofs/decompressor.c
> @@ -28,6 +28,18 @@ struct z_erofs_decompressor {
> char *name;
> };
>
> +int z_erofs_load_lz4_config(struct erofs_sb_info *sbi,
> + struct erofs_super_block *dsb)
> +{
> + u16 distance = le16_to_cpu(dsb->lz4_max_distance);
> +
> + sbi->lz4_max_distance_pages = distance ?
> + (DIV_ROUND_UP(distance, PAGE_SIZE) + 1) :
Unneeded parentheses here (I'll update it when applying).
Otherwise it looks good to me.
Reviewed-by: Gao Xiang <hsiangkao@redhat.com>
Thanks,
Gao Xiang
next prev parent reply other threads:[~2021-02-23 7:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 7:31 [PATCH v3] erofs: support adjust lz4 history window size Huang Jianan via Linux-erofs
2021-02-23 7:44 ` Gao Xiang [this message]
2021-02-23 8:13 ` Gao Xiang via Linux-erofs
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=20210223074418.GA1269766@xiangao.remote.csb \
--to=hsiangkao@redhat.com \
--cc=guoweichao@oppo.com \
--cc=huangjianan@oppo.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhangshiming@oppo.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).