Re: Improve page refcount scalability
From: Linus Torvalds
Date: Wed Oct 14 2026 - 14:25:03 EST
On Wed, 14 Oct 2026 at 10:44, Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> 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.
I might be wrong. Adding Jaegeuk to the cc.
Linus