mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kiryl Shutsemau <kas@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, David Hildenbrand <david@kernel.org>,
	 Boris Burkov <boris@bur.io>, Lorenzo Stoakes <ljs@kernel.org>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	 Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	 Michal Hocko <mhocko@suse.com>, Jan Kara <jack@suse.cz>,
	Rik van Riel <riel@surriel.com>,  Harry Yoo <harry@kernel.org>,
	Lance Yang <lance.yang@linux.dev>, Jann Horn <jannh@google.com>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	 "Darrick J. Wong" <djwong@kernel.org>,
	Carlos Maiolino <cem@kernel.org>,
	 Usama Arif <usama.arif@linux.dev>,
	Pedro Falcato <pfalcato@suse.de>,
	linux-mm@kvack.org,  linux-fsdevel@vger.kernel.org,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	 kernel-team@meta.com
Subject: Re: [RFC PATCH 0/5] mm: sub-folio dirty tracking for PTE-mapped mmap writes
Date: Wed, 16 Sep 2026 18:09:17 +0100	[thread overview]
Message-ID: <aqrJAX6nMTIo6Vnn@thinkstation> (raw)
In-Reply-To: <aqrDfoFFr8o0Mf0G@casper.infradead.org>

On Wed, Sep 16, 2026 at 05:27:42PM +0100, Matthew Wilcox wrote:
> On Mon, Sep 07, 2026 at 11:15:15AM +0100, Kiryl Shutsemau wrote:
> > Boris pointed me to Matthew's proposal to remove ->dirty_folio:
> > 
> > https://lore.kernel.org/all/aoyWln-Gt-yvZQkE@casper.infradead.org
> 
> Thanks, Boris ;-)
> 
> > I agree that the current ->dirty_folio() makes little sense and that
> > dirtying the folio can be bundled into ->page_mkwrite(), as they are
> > matched 1-to-1.
> > 
> > My proposal makes the distinction between making the folio writable and
> > making it dirty meaningful. ->page_mkwrite() allocates whatever is needed
> > on the filesystem side to track dirty state and drive writeback for the
> > *folio*, while ->dirty_folio_range() marks part of the folio dirty.
> 
> Why do you think that's a meaningful distinction?  We create a writable
> PTE because we've taken a page fault for write.  There's probably a few
> naoseconds where the PTE is writable+clean before it becomes
> writable+dirty, but even then sometimes we do both pte_mkwrite() and
> pte_mkdirty() as an optimisation in the write fault path.

This is true for the PTE that the fault was for. But we don't necessarily
want to dirty the other 511 pages at the same time.

The basic idea is to make the whole folio writable at fault and shift
dirtying to be per-PTE on write to it.

> > We can still drop ->dirty_folio(). A filesystem can provide
> > ->dirty_folio_range() if it wants fine-grained (sub-folio) dirty
> > tracking.
> > 
> > A separate question is whether we want to avoid installing a writable PMD
> > entry for filesystems that want fine-grained dirty tracking. I have a
> > patch for this, but it deserves a separate discussion once we agree that we
> > want this for PTE-mapped folios first.
> > 
> > Any feedback?
> 
> It's very odd to be optimising for shared-writable-mmap.  This is a
> horrid model for I/O.  https://cs.brown.edu/people/acrotty/pubs/p13-crotty.pdf

Sure.

But not everybody got the memo[1] :P

I think it worth considering if we want to make large folio adoption
smoother.

[1] https://www.reddit.com/r/bcachefs/comments/1vepk4a/comment/p1sn4v1/

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

  reply	other threads:[~2026-09-16 17:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 18:29 Kiryl Shutsemau
2026-09-03 18:29 ` [RFC PATCH 1/5] mm: let folio_mkclean() report which pages had dirty PTEs Kiryl Shutsemau
2026-09-09 10:12   ` Usama Arif
2026-09-10 13:36     ` Kiryl Shutsemau
2026-09-03 18:29 ` [RFC PATCH 2/5] mm: add a_ops->dirty_folio_range() and use the mkclean dirty harvest Kiryl Shutsemau
2026-09-09 10:51   ` Usama Arif
2026-09-10 14:54     ` Kiryl Shutsemau
2026-09-03 18:29 ` [RFC PATCH 3/5] mm: keep the mmap dirty range down to the faulting page Kiryl Shutsemau
2026-09-03 18:29 ` [RFC PATCH 4/5] iomap: narrow page_mkwrite() dirtying " Kiryl Shutsemau
2026-09-03 18:29 ` [RFC PATCH 5/5] xfs: track mmap dirty state per block Kiryl Shutsemau
2026-09-03 19:55 ` [RFC PATCH 0/5] mm: sub-folio dirty tracking for PTE-mapped mmap writes Pedro Falcato
2026-09-03 21:18   ` Kiryl Shutsemau
2026-09-07 10:15 ` Kiryl Shutsemau
2026-09-16 16:27   ` Matthew Wilcox
2026-09-16 17:09     ` Kiryl Shutsemau [this message]
2026-09-16 17:19       ` Matthew Wilcox
2026-09-09 10:02 ` Usama Arif
2026-09-09 10:15   ` Kiryl Shutsemau

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=aqrJAX6nMTIo6Vnn@thinkstation \
    --to=kas@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=boris@bur.io \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@kernel.org \
    --cc=djwong@kernel.org \
    --cc=harry@kernel.org \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=kernel-team@meta.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.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=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=pfalcato@suse.de \
    --cc=riel@surriel.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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

all inboxes | Powered by JetHome®