Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3604439rwe; Mon, 17 Apr 2023 00:10:16 -0700 (PDT) X-Google-Smtp-Source: AKy350bOzFCuXSsyEXVcesjuca0TDW+GWq2l+gKznIsuPPUFFNFk9ST6yTBYbAX2awjc6iMxPnah X-Received: by 2002:a05:6a00:189f:b0:5a8:ad9d:83f with SMTP id x31-20020a056a00189f00b005a8ad9d083fmr23701165pfh.24.1681715416600; Mon, 17 Apr 2023 00:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681715416; cv=none; d=google.com; s=arc-20160816; b=hKKeF0ULsdMlkv36oci3NFcY0lfWlcMoQSuCXTgBIzfxpdIGQ2T4GGN4lipjZDWGqt 1lP32GENLPCy8+fWQF/eouMLPK1FfQynXvFujilY4WtVKge8URDQ7HCNEZDsSEahWIIG reiAEgHREaG4KtUsixGHXho+Lim7eslehQedUSfhY46/HluqaEh0rcZor01gjeRpiXjI zhvncDtN7HEyvhUv3P3ZnCIE0/H+1LRZYu88vjBFle+nnqZArli1YesA3867ium9wQlC Jw5h+d5i7wg/+XrrsKErPgDcBkvkAQGtGWXt9tEYP9KNjWu/T1O7fJP9XV3ylvh1Tcld yc1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WU1Eelp74KzEr0sUsJWlhFF4mGcWamWpqWGCcEgLmck=; b=yBmE3EDUgaRcY5BGOVRXrWK3vCBInFS+hI9zl1loLTA1v9ttm0FsXzrtx1hJHZp3lG 4hrxJgiVFnKy1IBxmXMHi9L21sD7sxxVC1C5Et/r77FrtDqcuInoJQ8KPlWZ5opMjKAU tI092/SrPhUcz0sqn+BS6N2h7aUTg3b6MCcHmDQiGPhcE7wqxYg67EFOCOblZVTt8nO+ VYU5MTYm49kD4ZtNi71p57KWID0MUfPFRovv2/7K1vLBIcYtV3KrtiuuDGg0+q9bkHjk qORUQJrNsKlRDBuUZu+U3VDzi76oiC79R0oIlFr8mo1dzEmBwy+rtk1R9s8CbyqNvq0W Pwdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=OMA9QK5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b0051b5256a3fdsi11168117pgk.305.2023.04.17.00.10.02; Mon, 17 Apr 2023 00:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=OMA9QK5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229478AbjDQHIV (ORCPT + 99 others); Mon, 17 Apr 2023 03:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjDQHHz (ORCPT ); Mon, 17 Apr 2023 03:07:55 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FAE92D4D for ; Mon, 17 Apr 2023 00:07:53 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id s6-20020a17090a698600b00247a7794e78so736663pjj.0 for ; Mon, 17 Apr 2023 00:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681715273; x=1684307273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=WU1Eelp74KzEr0sUsJWlhFF4mGcWamWpqWGCcEgLmck=; b=OMA9QK5JYfRz/6uRPusmZgaFyuzZt5tirWMC8362U7sSTgVunjwkfUw6WoxPQLFd4I fOaavt/27rhek78Lsx6Kh6C8r2GOBvJD5WY24nGd0ilJGcHI/svaw7C1Z4F+TfSKSQvu 2jHbGBBvEdabMc5HkUiXU1O5mvMxg4Y6rkGDTv/lVGTNxG7GlVqAdXKXNSDMNItkBhkj PApZWgg8Ibaw+VYALquT8T/Q3P59PbPTyLQ6Y8mTNN4gCAKogMajuCcESqNH3moie2vi SfWU3qLXZgrc88BGOWx6qguUJC4o+FpWf3Y63GgHsts1FepuP+sEsW2RReROgLZmAvj1 jW9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681715273; x=1684307273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WU1Eelp74KzEr0sUsJWlhFF4mGcWamWpqWGCcEgLmck=; b=E9/y3O16O71fQBt1AKCltNcjmwSVsm0mLXJNw5fNUbEFs0GYbMNxyt06Yl/2WCTztP VzYkMoTxVj+WhR9YGM1DJlEA8BvnfnkYF5/ya2KcoFpwqhTiUuL1ymYhDUH28KQ6Ex+9 or3bEXnmGJdFePKCm3iv6xiiufjdvfK4hQmAvCGZ0kwW84jR3kgpXP9adHak9wzKLFnU tbVW5Ly79awWJAdA7nasPcYstPhQAeez7pB6oPWt/efrHV8I+hY93xE1msCBepAqX2yl wzji64h50YtKnxRSQrqRk1G3u9QwEktbfjzvY9P1SpEH85ILHVFPhL/I083z2+jw4+Mw kxqg== X-Gm-Message-State: AAQBX9ea/pZ6HoqEchAzSc3gQ5GSrd0E+PeuAUlqdNqjVYSEscZtygaa DEguH/nCa7ToSKv4YL/5RGk= X-Received: by 2002:a17:902:ce8e:b0:1a6:b55c:8a7c with SMTP id f14-20020a170902ce8e00b001a6b55c8a7cmr9089032plg.57.1681715272965; Mon, 17 Apr 2023 00:07:52 -0700 (PDT) Received: from localhost ([156.236.96.165]) by smtp.gmail.com with ESMTPSA id a6-20020a170902b58600b001a19bde435fsm6945340pls.65.2023.04.17.00.07.50 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Apr 2023 00:07:52 -0700 (PDT) Date: Mon, 17 Apr 2023 15:15:06 +0800 From: Yue Hu To: Gao Xiang Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, jefflexu@linux.alibaba.com, linux-kernel@vger.kernel.org, huyue2@coolpad.com, zhangwen@coolpad.com Subject: Re: [PATCH] erofs: remove unneeded icur field from struct z_erofs_decompress_frontend Message-ID: <20230417151506.00006565.zbestahu@gmail.com> In-Reply-To: References: <20230417064136.5890-1-zbestahu@gmail.com> <26cdf7b0-5d7d-68ba-da76-1ad800708946@linux.alibaba.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=GB18030 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Apr 2023 15:00:25 +0800 Gao Xiang wrote: > On 2023/4/17 14:52, Gao Xiang wrote: > > > > > > On 2023/4/17 14:41, Yue Hu wrote: > >> From: Yue Hu > >> > >> The icur field is only used in z_erofs_try_inplace_io(). Let's just use > >> a local variable instead. And no need to check if the pcluster is inline > >> when setting icur since inline page cannot be used for inplace I/O. > > Where do we check if the pcluster is inline? /* since file-backed online pages are traversed in reverse order */ fe->icur = z_erofs_pclusterpages(fe->pcl); static inline unsigned int z_erofs_pclusterpages(struct z_erofs_pcluster *pcl) { if (z_erofs_is_inline_pcluster(pcl)) return 1; [...] > > >> > >> Signed-off-by: Yue Hu > > > > Nope, it's a behavior change. > > Other users could feed more inplace I/O pages before I/O submission > > to reduce memory consumption, it's common when applying stress model > > in low memory scenarios. > > Oh, I misread it. I think it can be done in this way although > each following users will now rescan the whole array all the time. > > Reviewed-by: Gao Xiang > > > > > Thanks, > > Gao Xiang > > > >> --- > >> ?0?2 fs/erofs/zdata.c | 13 +++++-------- > >> ?0?2 1 file changed, 5 insertions(+), 8 deletions(-) > >> > >> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c > >> index f759152feffa..f8bf2b227942 100644 > >> --- a/fs/erofs/zdata.c > >> +++ b/fs/erofs/zdata.c > >> @@ -554,9 +554,6 @@ struct z_erofs_decompress_frontend { > >> ?0?2?0?2?0?2?0?2?0?2 /* used for applying cache strategy on the fly */ > >> ?0?2?0?2?0?2?0?2?0?2 bool backmost; > >> ?0?2?0?2?0?2?0?2?0?2 erofs_off_t headoffset; > >> - > >> -?0?2?0?2?0?2 /* a pointer used to pick up inplace I/O pages */ > >> -?0?2?0?2?0?2 unsigned int icur; > >> ?0?2 }; > >> ?0?2 #define DECOMPRESS_FRONTEND_INIT(__i) { \ > >> @@ -707,11 +704,13 @@ static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe, > >> ?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2 struct z_erofs_bvec *bvec) > >> ?0?2 { > >> ?0?2?0?2?0?2?0?2?0?2 struct z_erofs_pcluster *const pcl = fe->pcl; > >> +?0?2?0?2?0?2 /* file-backed online pages are traversed in reverse order */ > > Although please help refine the comment below: > > /* scan & fill inplace I/O pages in the reverse order */ Ok, will refine it in v2. > > Thanks, > Gao Xiang > > >> +?0?2?0?2?0?2 unsigned int icur = pcl->pclusterpages; > >> -?0?2?0?2?0?2 while (fe->icur > 0) { > >> -?0?2?0?2?0?2?0?2?0?2?0?2?0?2 if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page, > >> +?0?2?0?2?0?2 while (icur > 0) { > >> +?0?2?0?2?0?2?0?2?0?2?0?2?0?2 if (!cmpxchg(&pcl->compressed_bvecs[--icur].page, > >> ?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2 NULL, bvec->page)) { > >> -?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2 pcl->compressed_bvecs[fe->icur] = *bvec; > >> +?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2 pcl->compressed_bvecs[icur] = *bvec; > >> ?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2 return true; > >> ?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2 } > >> ?0?2?0?2?0?2?0?2?0?2 } > >> @@ -877,8 +876,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe) > >> ?0?2?0?2?0?2?0?2?0?2 } > >> ?0?2?0?2?0?2?0?2?0?2 z_erofs_bvec_iter_begin(&fe->biter, &fe->pcl->bvset, > >> ?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2?0?2 Z_EROFS_INLINE_BVECS, fe->pcl->vcnt); > >> -?0?2?0?2?0?2 /* since file-backed online pages are traversed in reverse order */ > >> -?0?2?0?2?0?2 fe->icur = z_erofs_pclusterpages(fe->pcl); > >> ?0?2?0?2?0?2?0?2?0?2 return 0; > >> ?0?2 }