From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EFE2C46CA1 for ; Mon, 18 Sep 2023 18:25:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1B776B041C; Mon, 18 Sep 2023 14:25:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA57F6B041E; Mon, 18 Sep 2023 14:25:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 944A56B0420; Mon, 18 Sep 2023 14:25:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7E9AF6B041C for ; Mon, 18 Sep 2023 14:25:05 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4DEBB16046A for ; Mon, 18 Sep 2023 18:25:05 +0000 (UTC) X-FDA: 81250544970.21.3198031 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id AC9AD140002 for ; Mon, 18 Sep 2023 18:25:03 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hC17YkoD; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695061503; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TC8wfBk+ib87P7TgIQGCMrwtRUP58vsgw9dhZZ19d68=; b=BHNr2QK0vRFTBdxVWGqLIJP2sked1cZaJDeYQC5f9aIRA3wncA7HVoI1PKRYiw9VEuV57X PH4ir5fka34gafuPefRLowFUX9d7nIi7uVBRKq630+DLhzXreIjRfCuICVEj9GF146CA+e a5o5Ep2db0wgLtBhCYGkXyq3tm+DSx4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695061503; a=rsa-sha256; cv=none; b=e0py5/fjF2DmfUNSRC7snec9O8Nh+aKFeoKnNFDhm14fVfomMuGF9Nlyx6tgKvhiZv6re8 TGu3Ye5b7tnOlmR0F99VrKxpqjHDjpFw4gm1xMznP35ah5RbTd0xh2EduJ/ATlYbBweu0I 3gCQQzwfivXe4Lfh2ems8CoI1J05jxo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hC17YkoD; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=TC8wfBk+ib87P7TgIQGCMrwtRUP58vsgw9dhZZ19d68=; b=hC17YkoDr54/vXu9pLxNScC1tR 58CYaFjKwojnqasqeKRlYiiyhGN4QyLMZXo7pvNF53AngJGnujARir/IibZbgbOBHea1gQYCq/Adb bY5llp7euvOgmQscF8JZZw9iTzNILN3n52VgSdhzDId6M8HxQP0WtxdNDKMDmvtwQXhWX0X9/EnRZ 9Z6DFZm9ZT5/K0IK4Ws+5L/W2vrIs5ZY9T68/cVRDQHoxPATR3IoWSXl/ui2SpfPnqwTCmj9haQmR RirTOGJJ0Z7SauWIWNgcAPcK3Hu/mpvfOupj/ssb6jbVGh4m3ZRjt0hZ4omWsTPNe4GOm9Y3x16Ps SNP1t+ig==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qiIvX-00CXHT-W9; Mon, 18 Sep 2023 18:24:56 +0000 Date: Mon, 18 Sep 2023 19:24:55 +0100 From: Matthew Wilcox To: Luis Chamberlain 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: X-Rspamd-Queue-Id: AC9AD140002 X-Rspam-User: X-Stat-Signature: gw8ogb5u6kfz57qjjsznea1n1obourac X-Rspamd-Server: rspam03 X-HE-Tag: 1695061503-687750 X-HE-Meta: U2FsdGVkX19NhZQaMEXWoFUuE/D3XwRI2hGVO4NEvNRujwLwAbu2JijVnCkFpBOqL6y5YCsXsi6hs3fA1hBpY99YEAyOoE2HliLHnmtAMvvY+Q7Duxamfy6v07lMG5DzSgULvlvh5xGgnF2YSdY+IeRueZ7c1lXG9Nu7Jzz9TYHEq4D879KibNt1HMHtq4N8rYwtydgfeBIKom5nt0rXQu2kgIfKmcPi1Tn5j37bvqNIum3fO7iNg7SXgYqBW1ajw2Ao9gFE1WlLV66kfFOaCWqqzIiGs0iYmnMhk6+SWk4F7wCm+0P3dggiNxScSkHrkafGr2Naqjfo7wsVjobNcyhE3bgql//E42fIa+8TDQWI3xDJO4K9hI7pCMqe5JP9Y28ogql/bZt4b1t/CZWhXa4WIeXr3j/GE4R4je/RW6Hs2SUdbP4P4BdI1gQ2A8u2ADSkswuSmocvifTgOjDTeaU7c261Iq+laz7YfN41/oNguIsjT7DwHMyeLfkbFBbYT69fju8xR5siA7vN2n/FA8iDSWKGQdRJ7mo2kv3NCMJc7IVlhn2BeGQRdPUcrVtW5MkNOZbuoUpz2tVe3vPBwMXfmwheTX9Gqb+/GUzJqqT6eKlSiwZyfVslrhgCWaELG78WtI0BTNMEk1Nk0x2b/szFzff9a0hALZokVV9+1CIUkFyV/ivsO4xkn+Q/wOEZ7EG66mi8oQwrSX9Q7+6QWWBIXCTR2Xs10tPzhuKGi57CHeanFV4CR49IGHm5xJJIqhuzYf0edWxBgfZa/EvxgjGGehTApf4iHgxUAxYtuTdMz2ch+9OyEbwHGq9aQHFZH5kz1ra60szjZgUca36nsVpdwNFviLgbyYhuUSqWD8qtkFT/5vaFzxRVEDThxVUl8448BHHgoz2j05Wf8CtxfN0gjFLcR1dxwHqA3/WSYWpCCSTJg+0rNv6L+ihTcwb1vh/m4WfrfMdBo+sWLE6 x0Nh0eqa MSZv1KBCT7NRvqiR4ec3zDfa0+gidM8zkk36tUfjqfqb1OPz48Uu9wZPVcaKrkTHRLcUEV96TcPScAHl0gwZ2cDEImIf/qhe+omgveIbnpcuGBkUbMJIA82ktmmXe/IrbSASazO8vWtkpJM61WyArct3LILTTlaGx4+AcGe3G2fIJbgQ+VAAuoGVXN1nTXR01IFICEaJcWzmc+s0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. I don't see the buffer_head connection; 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.