Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp74303iof; Sun, 5 Jun 2022 21:33:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuHMbbtAxjTwWpU91nxNJnds/7nD6s8AMRrhuKg13JCHx4S/6xV0K8x7n0goevhOHWODPR X-Received: by 2002:a17:902:ce06:b0:15f:a51a:cdec with SMTP id k6-20020a170902ce0600b0015fa51acdecmr22197968plg.53.1654490003624; Sun, 05 Jun 2022 21:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654490003; cv=none; d=google.com; s=arc-20160816; b=N5szq3F0Mf6w/8bmZXyQFxPspvtxPC78B0Bwqyss23lrmgFTpD8kOyaissB0FopdPL +xMEe9iqQW/HwsZ6J2h9TGGx+GMdynTrVrGwRFrVytwKpmX3DTPXdz3VCtqOLwORM/iT pWcckhZEZYdhkUfkIJz32O2JuW/V4iXaYUDM9Evg9ovIEHF5WxVzJkXG0gDIQHYE4XLv ZadgmL8r1v3HKYmrqahMsoRteowF3FqUWsGeLGx1jQjMbARBT5suGDGLaFy6CkDbmaVl id15EyVm9/HeEGE200iDe2qNEGjjAP4LzH+v6RboGRNoKAUW0I3P+K6OUIFT+X9IwTn2 UzaA== 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:dkim-signature; bh=uif769frfrYihV6YiWxMGs5eBDpigCO/7kp1qxb3WTw=; b=T7qb/7obvOF+hdsBAMTywD6p8gdoEY8EdafAKwWQO7yi8nuclj/cls7ufwBp6gIsHP iqs6iLAltRxbznMW5waIkaAshW0E7m3aT0otWc9weZWdYFetstl8ur8dykoeLTg9YzXn sqH8p02hewlU9fC0dImFWJ+hNH2M+LOsDlGz1UL21yRNa0EA9KdwmwoSKBlJC3QpJQ+w q9gRH5InyUnBVRxIOLKDO5NqBdKnwwO0tmEtAvol7Roiuj6UqLX1azVdsF4gs2TmD2te cqctU2qzQsL6sIV0B6KxCQc96IHfRz99Z9VZvMg14Y7eJlLcDeQCLhiSz1U5+9QWHmuK pgrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=X1J8cjMI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l17-20020a056a0016d100b0051b4e546a3fsi10789172pfc.242.2022.06.05.21.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:33:23 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=X1J8cjMI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8AC411BE82; Sun, 5 Jun 2022 20:59:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237214AbiFBQr1 (ORCPT + 99 others); Thu, 2 Jun 2022 12:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237256AbiFBQrO (ORCPT ); Thu, 2 Jun 2022 12:47:14 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8354A183A4; Thu, 2 Jun 2022 09:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uif769frfrYihV6YiWxMGs5eBDpigCO/7kp1qxb3WTw=; b=X1J8cjMICzgCsxkFRDuSKDibuq +hwtjZyiS864Fr7r7uq4aQq4PFJK8VVPtTvA3dgtknuPKyw4EBX1JB9s+nB3KGFIgggx0e3+GLv3u vbMu5+YaAl+ytycERctp3YK+2C3G7+LSwiYpjGTDu3vDFtLiYXFNWI6jC5/2Q830MFIX++tvDHvXZ YvlqbcBvFT8uBesnZGkUqv2HHz+vBTH52qY0pR6Zv4ulCVylu2shMJjutQoPXpL42ScCwY04aQYHA 3aDk5gG94UFrHq7cR6qV4Oihdo5S6BMUAH89Wa7kSar0mhBXuMzt/ZEiI+pTDTLkoWTa+hq31TEtr btMsSDLw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwnyC-007HMt-Qg; Thu, 02 Jun 2022 16:46:48 +0000 Date: Thu, 2 Jun 2022 17:46:48 +0100 From: Matthew Wilcox To: Ira Weiny Cc: David Sterba , "Fabio M. De Francesco" , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] btrfs: Replace kmap() with kmap_local_page() Message-ID: References: <20220531145335.13954-1-fmdefrancesco@gmail.com> <20220601132545.GM20633@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Jun 02, 2022 at 09:22:15AM -0700, Ira Weiny wrote: > On Wed, Jun 01, 2022 at 03:25:45PM +0200, David Sterba wrote: > > On Tue, May 31, 2022 at 04:53:32PM +0200, Fabio M. De Francesco wrote: > > > This is the first series of patches aimed towards the conversion of Btrfs > > > filesystem from the use of kmap() to kmap_local_page(). > > > > We've already had patches converting kmaps and you're changing the last > > ones, so this is could be the last series, with two exceptions. > > > > 1) You've changed lzo.c and zlib. but the same kmap/kunmap pattern is > > used in zstd.c. > > I checked out zstd.c and one of the issues there is the way that the input > workspace is mapped page by page while iterating those pages. > > This got me thinking about what Willy said at LSFmm concerning something like > kmap_local_range(). Mapping more than 1 page at a time could save some > unmap/remap of output pages required for kmap_local_page() ordering. Umm ... Not entirely sure what I said, but it'd be really hard to kmap multiple pages with the current PAE implementation. I've steered away from doing that for now, and kmap_local_folio() just guarantees the page that the offset lands in is mapped. I don't think the right answer is having a kmap_folio() that will map the entire folio. I'd be more tempted to add vmap_folio() for that. My understanding is that PAE systems have more address space available for vmap than they do for kmap. > Unfortunately, I think the length of the input is probably to long in many > cases. And some remapping may still be required. > > Cc: Willy > > As an aside, Willy, I'm thinking that a kmap_local_range() should return a > folio in some way. Would you agree? I imagine it taking a folio to describe the range that's being accessed. But maybe it should be a phys_addr_t? I tend to prefer phys_addr_t over pfn + offset as it's more compact on 64-bit systems and the same on 32-bit systems.