Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2183855pxb; Tue, 23 Feb 2021 00:02:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzokqthj5VmUtxu4u2D7yqPzNWKwPue9rQP/XKvoCeKYWC0JXYTx8dzt6266c3xOP+LYAvM X-Received: by 2002:aa7:d154:: with SMTP id r20mr1176049edo.202.1614067329140; Tue, 23 Feb 2021 00:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614067329; cv=none; d=google.com; s=arc-20160816; b=tHS+YDtSbA7EIoz2uU5ITU3OfhLTYBPjbjC9EXSwT9MHD6kinUeUYbQWNTPZiVHJK8 TU1636lvNE+DrEXxTZLgbIz3CYAtRxRkpZekcZZe+/Kn6yIAVXb7R9/SfWbKcCn3lNKx IQT53BkRXfrfTO9le368P/LdFiAffIgzLN6cPEcwP5TzdnNyOk4gX0KT7pLdOPOUdehL ScnprlSya8kHs58BketLlkbv4EmcIGlhRGK+54r1KvDqAc0x3bzPvk5b72fOtrNr6rK2 ChtlehEYZOZzrpRK05CWVg/FQSjCqf1uDynNvY6WveXuVtMIKHsO9O5Fnpl7muzLskkB PiWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=CSL7R8N6aFwp9SJMIxBXlxzl46HE12DDQh37CYhkuaQ=; b=nt0XAiEFw7XQBjer22nNAC0/NhdkIW99bRWaqjOKCBbvoVglGMd0aAmx6Q4VPsQE1l 9Wmv7uQLlbIwqGoBgGWxuQTQ7EAY9XEfEPNP52mw6FwycxGnym5+ytTdLFLg3q8SyuF3 AS1rKRO8N6KRXhPD5AOxsY0HFx7l7l4OTa8xu6NX3kqHVr3U50gn9MzvHXaBoGyy4qUv fzGLtgLfBXDMcarbM1tjRseSAXSxFdp1i9SlkKLzaQvPs8VQdHv8PbK9LNm3MwLP7uYS vJA3LJC5IO5ZBpJQO2VxiMigysqtkF66PklPF6jEJfyMtnUj4htwCmhz52hFbdkC9H6v P7Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GvK7vw9E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si13344423edr.607.2021.02.23.00.01.36; Tue, 23 Feb 2021 00:02:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GvK7vw9E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231951AbhBWHqT (ORCPT + 99 others); Tue, 23 Feb 2021 02:46:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50003 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231937AbhBWHqR (ORCPT ); Tue, 23 Feb 2021 02:46:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614066290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CSL7R8N6aFwp9SJMIxBXlxzl46HE12DDQh37CYhkuaQ=; b=GvK7vw9EhPBey0+M5ELgCdORd7RfDg6tjxF6gvLe2iDbyTvE+YQ3GI1UFCMgO2UKsQv39H EzhhX0Hnk9dsIEeLMbtcPdTAOyE8hADZTpRIER3/7KONqPE/BCrk51oWKaXBnwSVzbhqnF s9UcH4uHcqAbFgkTfmMn7XOkGvbH/oU= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-4grnEWBxOouELFLIcLeqjA-1; Tue, 23 Feb 2021 02:44:30 -0500 X-MC-Unique: 4grnEWBxOouELFLIcLeqjA-1 Received: by mail-pl1-f200.google.com with SMTP id o8so9624578pls.7 for ; Mon, 22 Feb 2021 23:44:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CSL7R8N6aFwp9SJMIxBXlxzl46HE12DDQh37CYhkuaQ=; b=HpHOc9BO5IiTP3WzUjJ9CaWk2BjAMCNtJ8prJ5odumOoTcgaOJCHLQuWsWmlnlg//l EBgZj5JfWJdXcEGqxr4jAgp22ZJoS5pBa9Y+QFpKN/FkqXXJQK/cOkbGh8THSbycIymd y1odtoBaSu5Iwv27qSg4nf35QdHj9gX/5C0FZ+lWFPNBWSpeh6avSLHFbt/E+ZOmrS0j FxVoPt5XrRXvm+CN1UMOhj5EJJSTZmBnuhN/71OtN2kvDCZxJiZ0dDXSc4scqpdXC3UG J7p2gHuEY50pNli4y7kT2y9BlK33AF+cjsSQA9sECBjWAu7Xl2h8d7cY0A0hLEAwg7kF zCJg== X-Gm-Message-State: AOAM530mgAlw377OmsIyhFth27AKeN02kCCiPgRM7VMljDtT04CsgGg0 OZUHRWWYOBn/wxwCbI1X1s9P2pQuTH3DxlMlbgDvktX229iuOLKrigd3fSgtr4NNsoahulW7KDj wb0dHViPDHObpHLBRe8Iuo4P4 X-Received: by 2002:a17:90a:4e0b:: with SMTP id n11mr28454039pjh.145.1614066269755; Mon, 22 Feb 2021 23:44:29 -0800 (PST) X-Received: by 2002:a17:90a:4e0b:: with SMTP id n11mr28454027pjh.145.1614066269540; Mon, 22 Feb 2021 23:44:29 -0800 (PST) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id s62sm14021560pfb.148.2021.02.22.23.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Feb 2021 23:44:29 -0800 (PST) Date: Tue, 23 Feb 2021 15:44:18 +0800 From: Gao Xiang To: Huang Jianan Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, guoweichao@oppo.com, zhangshiming@oppo.com Subject: Re: [PATCH v3] erofs: support adjust lz4 history window size Message-ID: <20210223074418.GA1269766@xiangao.remote.csb> References: <20210223073119.69232-1-huangjianan@oppo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210223073119.69232-1-huangjianan@oppo.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 > Signed-off-by: Guo Weichao > --- > > 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 Thanks, Gao Xiang