Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp188516rdb; Mon, 18 Sep 2023 11:52:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMlJaAmd7a/oNxKKeoJFHbWQHq4tk6dQ16mwXov//MkIL/Nqm0tRYDBTdrrJYGBLNoCXqI X-Received: by 2002:a17:90b:128a:b0:26b:698f:dda7 with SMTP id fw10-20020a17090b128a00b0026b698fdda7mr7321764pjb.32.1695063153939; Mon, 18 Sep 2023 11:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695063153; cv=none; d=google.com; s=arc-20160816; b=fONGr8t2qT26t7h7jhMb9Hgtcm44LysZhRwIw9phP9I5Ox5m8VpkHuj/DrIlnnnHqC k4a1AQ7OjG11QQsoZb6ZmoDJZfzON6ZvNsEUogo0clLkQDawPkB701XyBKwLWAfgquVp bb1P00ksxL00IcQ+JbKs7EanuvjGqN+kxFWttJ/Ni8N7kXfnp0UW75ei7X1yzg/Pt46B rscNxxmqMXw1WmsQeTyTHH9YGVmy7n7DrQREjuLS4nDKgoSZVin6Mlt1DbPoZ+2qtOIg BW9DIHCTazfITv05NV2wW4Aony8Mw03oAzE9uN9hbcM3K/ZzaBR/T0NFVDQlc/CjSrUt Tp+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ioc9mhO9oS3pTCUmAiffPAnO0TMPDBthf0n0SicOcH8=; fh=sp7sBsZTUf9rXqNOLzJE/lgZCTn3jJhl8tztR7PyMWg=; b=W1AWW9Q8ywlgijhwJDGld9FCR/5TjxL19ikgta2lDQKSJGjF+9BfVr2tKi++XQKd7l QQ1Ktg4kxtgYAv7Hj23hY7f8pirENLs5ARR/wgp3A6Ajohk139ECk/c7YnAsHIdpy53j XmPXjnO3S5bWPItz5ObpLC5xsmo58Kv9x7JsQWjcOfiSzEGeqxHwT8njv/48DYfIpGrT Rnnv2UhgGuM9Izqi25LiuNPWIy7kMJ5OKl8IYf54Xt9o9ct8kGVHRQismR1rmoXkuSlA FxPw3k3TMusgAi5cewdeWtFSx2+uEmcoebxKYKgd+HrXRXClSnzF+MJAq0e//0r/UmMu uAZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=oT9ZRHMT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id kk17-20020a17090b4a1100b00262f0035181si11176926pjb.26.2023.09.18.11.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 11:52:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=oT9ZRHMT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7D1E5804C499; Mon, 18 Sep 2023 11:42:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbjIRSm1 (ORCPT + 99 others); Mon, 18 Sep 2023 14:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbjIRSmZ (ORCPT ); Mon, 18 Sep 2023 14:42:25 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17298123; Mon, 18 Sep 2023 11:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ioc9mhO9oS3pTCUmAiffPAnO0TMPDBthf0n0SicOcH8=; b=oT9ZRHMTXK0XFkVcgbXfClVqKj M1Ht4wZqVZ7PBbNl7hmEy4EKtEoAYYPil0fwgeQuZgGt+HbOHy17MbjwEX79MLTqf4uPONoDh1o0K C5R3xjIU9AuYsrfX/IYZhznjhu8UAknbQyc92qT2nGVkUCoyO9YQbru8CdVNMVv0qnQd9qhzd5HSW bfDrXQ7Io6hlSSweNanzdOHmc06PpYuqb6M43Gzag8G4CxW3pwjXIBs3PpWmGmnVYhO+JzPTo0SLG axmXY0I9ESij1KH1ensXTjdCjTT2iOBx159xi03Ow/+8qx89GGMERl3Z2AXiNthGe1sCvtgDFaGXU sGGh2kdA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qiJCJ-00G6EF-0n; Mon, 18 Sep 2023 18:42:15 +0000 Date: Mon, 18 Sep 2023 11:42:15 -0700 From: Luis Chamberlain To: Matthew Wilcox Cc: Daniel Gomez , "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "gost.dev@samsung.com" , Pankaj Raghav Subject: Re: [PATCH 1/6] filemap: make the folio order calculation shareable Message-ID: References: <20230915095042.1320180-1-da.gomez@samsung.com> <20230915095042.1320180-2-da.gomez@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 18 Sep 2023 11:42:33 -0700 (PDT) On Mon, Sep 18, 2023 at 07:24:55PM +0100, Matthew Wilcox wrote: > On Mon, Sep 18, 2023 at 11:09:00AM -0700, Luis Chamberlain wrote: > > On Fri, Sep 15, 2023 at 02:40:07PM +0100, Matthew Wilcox wrote: > > > On Fri, Sep 15, 2023 at 09:51:23AM +0000, Daniel Gomez wrote: > > > > To make the code that clamps the folio order in the __filemap_get_folio > > > > routine reusable to others, move and merge it to the fgf_set_order > > > > new subroutine (mapping_size_order), so when mapping the size at a > > > > given index, the order calculated is already valid and ready to be > > > > used when order is retrieved from fgp_flags with FGF_GET_ORDER. > > > > > > > > Signed-off-by: Daniel Gomez > > > > --- > > > > fs/iomap/buffered-io.c | 6 ++++-- > > > > include/linux/pagemap.h | 42 ++++++++++++++++++++++++++++++++++++----- > > > > mm/filemap.c | 8 -------- > > > > 3 files changed, 41 insertions(+), 15 deletions(-) > > > > > > That seems like a lot of extra code to add in order to avoid copying > > > six lines of code and one comment into the shmem code. > > > > > > It's not wrong, but it seems like a bad tradeoff to me. > > > > The suggestion to merge came from me, mostly based on later observations > > that in the future we may want to extend this with a min order to ensure > > the index is aligned the the order. This check would only be useful for > > buffred IO for iomap, readahead. It has me wondering if buffer-heads > > support for large order folios come around would we a similar check > > there? > > > > So Willy, you would know better if and when a shared piece of code would > > be best with all these things in mind. > > In my mind, this is fundamentally code which belongs in the page cache > rather than in individual filesystems. The fly in the ointment is that > shmem has forked the page cache in order to do its own slightly > specialised thing. Do we do any effort *now* try to to not make that situation worse? This just being one example. > I don't see the buffer_head connection; I haven't reviewed yet Hannes' patches yet but I was wondering if for bf there was also a loop to target a high order and retry until you get the min order allowed. > shmem is > an extremely special case, and we shouldn't mess around with other > filesystems to avoid changing shmem. > > Ideally, we'd reunify (parts of) shmem and the regular page cache, but > that's a lot of work, probably involving the swap layer changing. Well so indeed swap effort will be next, so addressing if we should not make the situation worse as we add more code would be good to know. Luis