mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
	Pedro Falcato <pfalcato@suse.de>, Harry Yoo <harry@kernel.org>,
	"David Hildenbrand (Arm)" <david@kernel.org>,
	Ilya Gladyshev <ilya.gladyshev@linux.dev>,
	Matthew Wilcox <willy@infradead.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: Improve page refcount scalability
Date: Thu, 15 Oct 2026 02:12:19 +0000	[thread overview]
Message-ID: <atA2g8OgpiNOiVL_@google.com> (raw)
In-Reply-To: <CAHk-=wh+1Hz+3HJ8evmh=FKO1fCGiwuNTqArXEfe-tAJ6hDy0A@mail.gmail.com>

On 10/14, Linus Torvalds wrote:
> On Wed, 14 Oct 2026 at 10:44, Kirill A. Shutemov <kirill@shutemov.name> wrote:
> >
> > I already have it:
> 
> So that was my thinking too, but I have my notes (from the original
> truncage/hole punch patch) about mapping_exiting() being problematic
> due to f2fs playing games with it.
> 
> Now, that's probably just a f2fs bug waiting to happen independently
> of this. But the path is
> 
> ioctl(F2FS_IOC_START_ATOMIC_REPLACE) ->
>   f2fs_ioc_start_atomic_write() ->
>     truncate_inode_pages_final()
> 
> and that truncate_inode_pages_final() is the problem - it's what sets
> mapping_set_exiting() on a live inode.
> 
> I had this as a note for the original branch, and it became a
> non-issue with the change to the "set PG_rcu_free on hot pages in the
> read path" instead.
> 
> But your change makes it an issue again.
> 
> Now, I think f2fs really is just buggy here. Calling
> truncate_inode_pages_final() on something that is still live
> afterwards is wrong - because it's not "final". As far as I can tell,
> there may still be hundreds of active readers holding that fd open.

F2FS_IOC_START_ATOMIC_REPLACE was supposed to replace a heavy ATOMIC_FILE class
in Android, consisting of 1) creating a backup file, 2) write data to the file, 3)
fsync(), 4) rename(to original one), 5) fsync(dir).

Indeed, it's a bug that user can see zeros between F2FS_IOC_START_ATOMIC_REPLACE
and F2FS_IOC_COMMIT_ATOMIC_WRITE. I think we need to move the truncation path
into the commit phase and use truncate_inode_pages() instead.

> 
> I might be wrong. Adding Jaegeuk to the cc.
> 
>                  Linus

      reply	other threads:[~2026-10-15  2:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 18:43 Linus Torvalds
2026-10-13 21:03 ` Matthew Wilcox
2026-10-13 21:26   ` Linus Torvalds
2026-10-13 23:20   ` Paul E. McKenney
2026-10-14 10:36   ` Kiryl Shutsemau
2026-10-14 10:46     ` David Hildenbrand (Arm)
2026-10-13 22:43 ` Kiryl Shutsemau
2026-10-13 23:39   ` Linus Torvalds
2026-10-14 11:53     ` Kiryl Shutsemau
2026-10-14 15:28       ` Matthew Wilcox
2026-10-14  0:10 ` Harry Yoo
2026-10-14  1:01   ` Linus Torvalds
2026-10-14 13:59     ` Pedro Falcato
2026-10-14 16:25       ` Linus Torvalds
2026-10-14 16:59         ` Linus Torvalds
2026-10-14 17:15           ` Linus Torvalds
2026-10-14 17:43           ` Kirill A. Shutemov
2026-10-14 18:24             ` Linus Torvalds
2026-10-15  2:12               ` Jaegeuk Kim [this message]

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=atA2g8OgpiNOiVL_@google.com \
    --to=jaegeuk@kernel.org \
    --cc=david@kernel.org \
    --cc=harry@kernel.org \
    --cc=ilya.gladyshev@linux.dev \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pfalcato@suse.de \
    --cc=torvalds@linux-foundation.org \
    --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®