linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Daniel Gomez <da.gomez@samsung.com>,
	"minchan@kernel.org" <minchan@kernel.org>,
	"senozhatsky@chromium.org" <senozhatsky@chromium.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"djwong@kernel.org" <djwong@kernel.org>,
	"hughd@google.com" <hughd@google.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"gost.dev@samsung.com" <gost.dev@samsung.com>,
	Pankaj Raghav <p.raghav@samsung.com>
Subject: Re: [PATCH 1/6] filemap: make the folio order calculation shareable
Date: Mon, 18 Sep 2023 19:24:55 +0100	[thread overview]
Message-ID: <ZQiV96mTMiSXF9yf@casper.infradead.org> (raw)
In-Reply-To: <ZQiSPEKRJSkeh3Fe@bombadil.infradead.org>

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 <da.gomez@samsung.com>
> > > ---
> > >  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.


  reply	other threads:[~2023-09-18 18:25 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230915095123eucas1p2c23d8a8d910f5a8e9fd077dd9579ad0a@eucas1p2.samsung.com>
2023-09-15  9:51 ` [PATCH 0/6] shmem: high order folios support in write path Daniel Gomez
     [not found]   ` <CGME20230915095124eucas1p1eb0e0ef883f6316cf14c349404a51150@eucas1p1.samsung.com>
2023-09-15  9:51     ` [PATCH 1/6] filemap: make the folio order calculation shareable Daniel Gomez
2023-09-15 13:40       ` Matthew Wilcox
2023-09-18  8:41         ` Daniel Gomez
2023-09-18 18:09         ` Luis Chamberlain
2023-09-18 18:24           ` Matthew Wilcox [this message]
2023-09-18 18:42             ` Luis Chamberlain
     [not found]   ` <CGME20230915095126eucas1p2cf75674dab8a81228f493a7200f4a1ba@eucas1p2.samsung.com>
2023-09-15  9:51     ` [PATCH 2/6] shmem: drop BLOCKS_PER_PAGE macro Daniel Gomez
     [not found]   ` <CGME20230915095128eucas1p2885c3add58d82413d9c1d17832d3d281@eucas1p2.samsung.com>
2023-09-15  9:51     ` [PATCH 3/6] shmem: account for large order folios Daniel Gomez
2023-09-15 12:14       ` Matthew Wilcox
2023-09-15 13:44       ` Matthew Wilcox
     [not found]   ` <CGME20230915095129eucas1p1383d75c6d62056afbb20b78a3ec15234@eucas1p1.samsung.com>
2023-09-15  9:51     ` [PATCH 4/6] shmem: add order parameter support to shmem_alloc_folio Daniel Gomez
2023-09-15 12:19       ` Matthew Wilcox
     [not found]   ` <CGME20230915095131eucas1p1010e364cd1c351e5b7379954bd237a3d@eucas1p1.samsung.com>
2023-09-15  9:51     ` [PATCH 5/6] shmem: add file length in shmem_get_folio path Daniel Gomez
2023-09-15 15:37       ` Matthew Wilcox
     [not found]   ` <CGME20230915095133eucas1p267bade2888b7fcd2e1ea8e13e21c495f@eucas1p2.samsung.com>
2023-09-15  9:51     ` [PATCH 6/6] shmem: add large folios support to the write path Daniel Gomez
2023-09-15 18:26       ` Yosry Ahmed
2023-09-18  8:00         ` Daniel Gomez
2023-09-18 18:55           ` Yosry Ahmed
2023-09-19 13:27             ` Daniel Gomez
2023-09-19 16:00               ` Yosry Ahmed
2023-09-19 21:46                 ` Luis Chamberlain
2023-09-19 21:51                   ` Yosry Ahmed
2023-09-15 15:29   ` [PATCH 0/6] shmem: high order folios support in " David Hildenbrand
2023-09-15 15:34     ` Matthew Wilcox
2023-09-15 15:36       ` David Hildenbrand
2023-09-15 15:40         ` Matthew Wilcox
2023-09-15 15:43           ` David Hildenbrand
2023-09-18  7:32     ` Daniel Gomez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQiV96mTMiSXF9yf@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=da.gomez@samsung.com \
    --cc=djwong@kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=hughd@google.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=minchan@kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).