From: Kiryl Shutsemau <kirill@shutemov.name>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Rik van Riel <riel@surriel.com>,
Harry Yoo <harry.yoo@oracle.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Dave Chinner <david@fromorbit.com>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 2/2] mm/truncate: Unmap large folio on split failure
Date: Wed, 29 Oct 2025 17:10:45 +0000 [thread overview]
Message-ID: <iqzgqvkin6istylyqqias7bwulhh2s6l6aqepssk6ptfu5dddy@q2rfk3wewcbz> (raw)
In-Reply-To: <20251029151947.GM6174@frogsfrogsfrogs>
On Wed, Oct 29, 2025 at 08:19:47AM -0700, Darrick J. Wong wrote:
> On Wed, Oct 29, 2025 at 10:21:53AM +0000, Kiryl Shutsemau wrote:
> > On Wed, Oct 29, 2025 at 02:12:48AM -0700, Hugh Dickins wrote:
> > > On Mon, 27 Oct 2025, Kiryl Shutsemau wrote:
> > > > On Mon, Oct 27, 2025 at 03:10:29AM -0700, Hugh Dickins wrote:
> > > ...
> > > >
> > > > > Aside from shmem/tmpfs, it does seem to me that this patch is
> > > > > doing more work than it needs to (but how many lines of source
> > > > > do we want to add to avoid doing work in the failed split case?):
> > > > >
> > > > > The intent is to enable SIGBUS beyond EOF: but the changes are
> > > > > being applied unnecessarily to hole-punch in addition to truncation.
> > > >
> > > > I am not sure much it should apply to hole-punch. Filesystem folks talk
> > > > about writing to a folio beyond round_up(i_size, PAGE_SIZE) being
> > > > problematic for correctness. I have no clue if the same applies to
> > > > writing to hole-punched parts of the folio.
> > > >
> > > > Dave, any comments?
> > > >
> > > > Hm. But if it is problematic it has be caught on fault. We don't do
> > > > this. It will be silently mapped.
> > >
> > > There are strict rules about what happens beyond i_size, hence this
> > > patch. But hole-punch has no persistent "i_size" to define it, and
> > > silently remapping in a fresh zeroed page is the correct behaviour.
> >
> > I missed that we seems to be issuing vm_ops->page_mkwrite() on remaping
> > the page, so it is not completely silent for filesystem and can do its
> > thing to re-allocate metadata (or whatever) after hole-punch.
> >
> > So, I see unmap on punch-hole being justified.
>
> Most hole punching implementations in filesystems will take i_rwsem and
> mmap_invalidate lock, flush the range to disk and unmap the pagecache
> for all the fsblocks around that range, and only then update the file
> space mappings. If the unmap fails because a PMD couldn't be split,
> then we'll just return that error to userspace and they can decide what
> to do when fallocate() fails.
Unmap does not fail and PMD can be split at any time. But split of large
folios can fail if there's an external pin on it.
--
Kiryl Shutsemau / Kirill A. Shutemov
next prev parent reply other threads:[~2025-10-29 17:10 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 9:32 [PATCHv2 0/2] Fix SIGBUS semantics with large folios Kiryl Shutsemau
2025-10-23 9:32 ` [PATCHv2 1/2] mm/memory: Do not populate page table entries beyond i_size Kiryl Shutsemau
2025-10-23 20:49 ` Andrew Morton
2025-10-23 20:54 ` David Hildenbrand
2025-10-23 21:36 ` Andrew Morton
2025-10-24 9:26 ` Kiryl Shutsemau
2025-10-26 4:54 ` Andrew Morton
2025-10-24 15:42 ` David Hildenbrand
2025-10-24 19:32 ` Kirill A. Shutemov
2025-10-27 9:34 ` David Hildenbrand
2025-10-27 8:20 ` Hugh Dickins
2025-10-27 9:14 ` Kiryl Shutsemau
2025-10-27 9:22 ` David Hildenbrand
2025-10-29 8:31 ` Hugh Dickins
2025-10-29 10:11 ` Kiryl Shutsemau
2025-10-30 5:59 ` Hugh Dickins
2025-10-30 17:08 ` Kiryl Shutsemau
2025-10-23 9:32 ` [PATCHv2 2/2] mm/truncate: Unmap large folio on split failure Kiryl Shutsemau
2025-10-23 20:56 ` Andrew Morton
2025-10-24 9:05 ` Kiryl Shutsemau
2025-10-24 15:43 ` David Hildenbrand
2025-10-27 10:10 ` Hugh Dickins
2025-10-27 10:38 ` David Hildenbrand
2025-10-27 10:40 ` Kiryl Shutsemau
2025-10-29 9:12 ` Hugh Dickins
2025-10-29 10:21 ` Kiryl Shutsemau
2025-10-29 15:19 ` Darrick J. Wong
2025-10-29 17:10 ` Kiryl Shutsemau [this message]
2025-10-23 17:47 ` [PATCHv2 0/2] Fix SIGBUS semantics with large folios Darrick J. Wong
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=iqzgqvkin6istylyqqias7bwulhh2s6l6aqepssk6ptfu5dddy@q2rfk3wewcbz \
--to=kirill@shutemov.name \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=brauner@kernel.org \
--cc=david@fromorbit.com \
--cc=david@redhat.com \
--cc=djwong@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=hughd@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--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