From: Greg KH <gregkh@linuxfoundation.org>
To: Kiryl Shutsemau <kas@kernel.org>
Cc: stable@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Christian Brauner <brauner@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
Dave Chinner <david@fromorbit.com>,
David Hildenbrand <david@redhat.com>,
Hugh Dickins <hughd@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Liam Howlett <liam.howlett@oracle.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Michal Hocko <mhocko@suse.com>, Mike Rapoport <rppt@kernel.org>,
Rik van Riel <riel@surriel.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
Suren Baghdasaryan <surenb@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 6.17.y] mm/truncate: unmap large folio on split failure
Date: Thu, 27 Nov 2025 13:44:08 +0100 [thread overview]
Message-ID: <2025112702-unrobed-recall-4fdc@gregkh> (raw)
In-Reply-To: <47zyadovna3yarouvvqrrqlvx7vxb5uul5muwjr4h25mqoyhl4@rdtannv4llvv>
On Fri, Nov 21, 2025 at 02:17:05PM +0000, Kiryl Shutsemau wrote:
> On Fri, Nov 21, 2025 at 01:20:08PM +0000, Kiryl Shutsemau wrote:
> > On Fri, Nov 21, 2025 at 10:46:11AM +0100, Greg KH wrote:
> > > On Thu, Nov 20, 2025 at 04:52:21PM +0000, Kiryl Shutsemau wrote:
> > > > Accesses within VMA, but beyond i_size rounded up to PAGE_SIZE are
> > > > supposed to generate SIGBUS.
> > > >
> > > > This behavior might not be respected on truncation.
> > > >
> > > > During truncation, the kernel splits a large folio in order to reclaim
> > > > memory. As a side effect, it unmaps the folio and destroys PMD mappings
> > > > of the folio. The folio will be refaulted as PTEs and SIGBUS semantics
> > > > are preserved.
> > > >
> > > > However, if the split fails, PMD mappings are preserved and the user will
> > > > not receive SIGBUS on any accesses within the PMD.
> > > >
> > > > Unmap the folio on split failure. It will lead to refault as PTEs and
> > > > preserve SIGBUS semantics.
> > > >
> > > > Make an exception for shmem/tmpfs that for long time intentionally mapped
> > > > with PMDs across i_size.
> > > >
> > > > Link: https://lkml.kernel.org/r/20251027115636.82382-3-kirill@shutemov.name
> > > > Fixes: b9a8a4195c7d ("truncate,shmem: Handle truncates that split large folios")
> > > > Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
> > > > Cc: Al Viro <viro@zeniv.linux.org.uk>
> > > > Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
> > > > Cc: Christian Brauner <brauner@kernel.org>
> > > > Cc: "Darrick J. Wong" <djwong@kernel.org>
> > > > Cc: Dave Chinner <david@fromorbit.com>
> > > > Cc: David Hildenbrand <david@redhat.com>
> > > > Cc: Hugh Dickins <hughd@google.com>
> > > > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > > > Cc: Liam Howlett <liam.howlett@oracle.com>
> > > > Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > > > Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> > > > Cc: Michal Hocko <mhocko@suse.com>
> > > > Cc: Mike Rapoport <rppt@kernel.org>
> > > > Cc: Rik van Riel <riel@surriel.com>
> > > > Cc: Shakeel Butt <shakeel.butt@linux.dev>
> > > > Cc: Suren Baghdasaryan <surenb@google.com>
> > > > Cc: Vlastimil Babka <vbabka@suse.cz>
> > > > Cc: <stable@vger.kernel.org>
> > > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > > > (cherry picked from commit fa04f5b60fda62c98a53a60de3a1e763f11feb41)
> > > > Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
> > > > ---
> > >
> > > Does not apply to 6.17.y at all :(
> > >
> > > Did you forget to apply this on top of other commits?
> >
> > Hm. It applies cleanly on v6.17.8:
> >
> > ❯ git log -1 --oneline @
> > 8ac42a63c561 (HEAD) Linux 6.17.8
> > ❯ b4 shazam 20251120165221.892852-1-kas@kernel.org
> > Grabbing thread from lore.kernel.org/all/20251120165221.892852-1-kas@kernel.org/t.mbox.gz
> > Breaking thread to remove parents of 20251120165221.892852-1-kas@kernel.org
> > Checking for newer revisions
> > Grabbing search results from lore.kernel.org
> > Analyzing 2 messages in the thread
> > Analyzing 1 code-review messages
> > Checking attestation on all messages, may take a moment...
> > ---
> > ✓ [PATCH] mm/truncate: unmap large folio on split failure
> > ---
> > ✓ Signed: DKIM/kernel.org
> > ---
> > Total patches: 1
> > ---
> > Applying: mm/truncate: unmap large folio on split failure
> >
> > Do you have anything on top of v6.17.8 in your 6.17.y queue?
> >
> > My other backport to 6.17.y doesn't interfere with the patch either.
>
> I see 6.17.9-rc1 includes
>
> 53241caf24c7 ("mm/huge_memory: do not change split_huge_page*() target order silently")
>
> With the patch applied, fa04f5b60fda ("mm/truncate: unmap large folio on
> split failure") can be cherry-picked cleanly.
Ah, that worked, thanks!
greg k-h
prev parent reply other threads:[~2025-11-27 12:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 16:13 FAILED: patch "[PATCH] mm/truncate: unmap large folio on split failure" failed to apply to 6.17-stable tree gregkh
2025-11-20 16:52 ` [PATCH 6.17.y] mm/truncate: unmap large folio on split failure Kiryl Shutsemau
2025-11-21 9:46 ` Greg KH
2025-11-21 13:20 ` Kiryl Shutsemau
2025-11-21 14:17 ` Kiryl Shutsemau
2025-11-27 12:44 ` Greg KH [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=2025112702-unrobed-recall-4fdc@gregkh \
--to=gregkh@linuxfoundation.org \
--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=hughd@google.com \
--cc=kas@kernel.org \
--cc=liam.howlett@oracle.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=stable@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.