Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp417187rwi; Tue, 18 Oct 2022 20:17:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4X4IxV1HcK6UFCX3Rj0OOCCV7oTVKrTCCQoDDuBv3F2MBmNQ+SLEv5J7x6+2Rx0D9ZpBU0 X-Received: by 2002:a17:903:2342:b0:181:bc30:b02f with SMTP id c2-20020a170903234200b00181bc30b02fmr6101016plh.30.1666149410542; Tue, 18 Oct 2022 20:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666149410; cv=none; d=google.com; s=arc-20160816; b=m5S/Qb8C5s6D7nSYrajUPrUpWIDkjVYKN9ApHeVjPwnd15aSADSS8elO5cUY7UpXX8 31OqP2/HMn7og0j8+IgZBaQHdgG5N2Hl2OaC1/CPJi/gmfdZ9Y9HScN5RWS2gC//Kb/B FFYltUSuC8BwuKvudXYomWYnWSGar0h6JTaI0POD5VciGEeNW/IJAjBtKLeMg5c2/H/S I0/m+iWwoYmmG5qaZCIt2NeK9EsGJGDswSRfg0fNarCHgzJsHI2q/CwqmBgXd4oTczgn HK8TCGMonGbstjL33zglGit5xtOdOhEM3FVK/Y5QucrhRdeia4NH+H1ZXOEf5gFy/RlT GIlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2ouf/kdG7dlT2IYjmlCDHAAEdR8yFG8Hwuyy00lWjr0=; b=zAZAIf5smu/ivKRXFmqIqr4svN/MU2LMqCKprq0NoH/x+r+RA6uxAyyfW5kqhNpMK8 oEkBNgR8VbuomzVIADzwwJqsvXdZInoVOZUwcr9utuKvKlfFedEfaDrOVNLiH/ZYwMdD FGcThTh7F5UcWUvFIdZa6KqXWcSEVkuP3yZ4TQPeuXXJ7Qkvm2KTfKj/fp+8HIQZn55B 09LpDfKI0gx6wMckEmr4ZU+iRPe+BfVSX9fKQ9Be2+h1r+ia/CqGgHRX9zZqwdmS/L+O ks3MYv4yfi9tY+5pRXAt1FAI1bGMlVfeATdITHXQg0alZdv+J6Ylr9bEaYBZUenoU00b knAA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mh8-20020a17090b4ac800b00205f5f70bcdsi19224864pjb.98.2022.10.18.20.16.38; Tue, 18 Oct 2022 20:16:50 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbiJSDHV (ORCPT + 99 others); Tue, 18 Oct 2022 23:07:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229874AbiJSDHJ (ORCPT ); Tue, 18 Oct 2022 23:07:09 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 743F591873 for ; Tue, 18 Oct 2022 20:07:03 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R801e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VSYayHV_1666148819; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VSYayHV_1666148819) by smtp.aliyun-inc.com; Wed, 19 Oct 2022 11:07:01 +0800 Date: Wed, 19 Oct 2022 11:06:58 +0800 From: Gao Xiang To: Ira Weiny Cc: "Fabio M. De Francesco" , linux-erofs@lists.ozlabs.org, Chao Yu , LKML Subject: Re: [PATCH v2] erofs: use kmap_local_page() only for erofs_bread() Message-ID: References: <20221018105313.4940-1-hsiangkao@linux.alibaba.com> <9108233.CDJkKcVGEf@mypc> <2019477.yKVeVyVuyW@mypc> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 Hi Ira, On Tue, Oct 18, 2022 at 07:51:55PM -0700, Ira Weiny wrote: > On Wed, Oct 19, 2022 at 07:36:55AM +0800, Gao Xiang wrote: > > On Wed, Oct 19, 2022 at 01:21:27AM +0200, Fabio M. De Francesco wrote: > > > On Tuesday, October 18, 2022 11:29:21 PM CEST Gao Xiang wrote: > > > > ... > > [snip] > > > > > > > In Btrfs I solved (thanks to David S.' advice) by mapping only one of two > > > pages, only the one coming from the page cache. > > > > > > The other page didn't need the use of kmap_local_page() because it was > > > allocated in the filesystem with "alloc_page(GFP_NOFS)". GFP_NOFS won't ever > > > allocate from ZONE_HIGHMEM, therefore a direct page_address() could avoid the > > > mapping and the nesting issues. > > > > > > Did you check if you may solve the same way? > > > > That is not simple. Currently we have compressed pages and decompressed > > pages (page cache or others), and they can be unmapped when either data > > is all consumed, so compressed pages can be unmapped first, or > > decompressed pages can be unmapped first. That quite depends on which > > pages goes first. > > > > I think such usage is a quite common pattern for decoder or encoder, > > you could take a look at z_erofs_lzma_decompress() in > > fs/erofs/decompressor_lzma.c. So kmap() is still useful for such cases > > since I don't really care the HIGHMEM performance but correctness, but > > other alternative could churn/complex the map/unmap/remap pattern. > > > > When you say kmap() is still useful is this because of the map/unmap ordering > restrictions or because the address is required in different threads? ... mainly due to map/unmap ordering restriction. I think the decompressor here could still be a simple dependency. I'm not sure if there are more complicated cases (like multiple decoding/encoding sources into target pages) though.. Thanks, Gao Xiang > > Ira