* + mm-memory_failure-reject-unsupported-non-folio-compound-page.patch added to mm-hotfixes-unstable branch
@ 2026-02-05 1:07 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-02-05 1:07 UTC (permalink / raw)
To: mm-commits, yuzhao, willy, vbabka, surenb, shicenci, rppt,
richard.weiyang, nao.horiguchi, mhocko, lorenzo.stoakes,
linmiaohe, liam.howlett, david, baolin.wang, ziy, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4582 bytes --]
The patch titled
Subject: mm/memory_failure: reject unsupported non-folio compound page
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-memory_failure-reject-unsupported-non-folio-compound-page.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory_failure-reject-unsupported-non-folio-compound-page.patch
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Zi Yan <ziy@nvidia.com>
Subject: mm/memory_failure: reject unsupported non-folio compound page
Date: Wed, 4 Feb 2026 19:56:03 -0500
When !CONFIG_TRANSPARENT_HUGEPAGE, a non-folio compound page can appear in
a userspace mapping via either vm_insert_*() functions or
vm_operatios_struct->fault(). They are not folios, thus should not be
considered for folio operations like split. Change memory_failure() and
soft_offline_page() to reject these non-folio compound pages as
EOPNOTSUPP.
Add PageNonFolioCompound() helper function. This function is functionally
equivalent to folio_test_large() && !folio_test_large_rmappable(), but it
is supposed to be used on struct page. So open code it instead.
Link: https://lkml.kernel.org/r/20260205005603.274383-1-ziy@nvidia.com
Fixes: 689b8986776c ("mm/memory-failure: improve large block size folio handling")
Signed-off-by: Zi Yan <ziy@nvidia.com>
Reported-by: 是参差 <shicenci@gmail.com>
Closes: https://lore.kernel.org/all/PS1PPF7E1D7501F1E4F4441E7ECD056DEADAB98A@PS1PPF7E1D7501F.apcprd02.prod.outlook.com/
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/page-flags.h | 16 ++++++++++++++++
mm/memory-failure.c | 9 ++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
--- a/include/linux/page-flags.h~mm-memory_failure-reject-unsupported-non-folio-compound-page
+++ a/include/linux/page-flags.h
@@ -1102,6 +1102,22 @@ static inline bool folio_contain_hwpoiso
bool is_free_buddy_page(const struct page *page);
+static inline bool PageNonFolioCompound(const struct page *page)
+{
+ if (PageCompound(page)) {
+ const struct page *head = compound_head(page);
+
+ /*
+ * Without CONFIG_TRANSPARENT_HUGEPAGE, PG_large_rmappable
+ * should not be set/used.
+ */
+ return !IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) ||
+ !test_bit(PG_large_rmappable, &head[1].flags.f);
+ }
+
+ return false;
+}
+
#ifdef CONFIG_MIGRATION
/*
* This page is migratable through movable_ops (for selected typed pages
--- a/mm/memory-failure.c~mm-memory_failure-reject-unsupported-non-folio-compound-page
+++ a/mm/memory-failure.c
@@ -2440,9 +2440,12 @@ try_again:
folio = page_folio(p);
- /* filter pages that are protected from hwpoison test by users */
+ /*
+ * filter pages that are protected from hwpoison test by users or
+ * unsupported non folio compound ones
+ */
folio_lock(folio);
- if (hwpoison_filter(p)) {
+ if (hwpoison_filter(p) || PageNonFolioCompound(p)) {
ClearPageHWPoison(p);
folio_unlock(folio);
folio_put(folio);
@@ -2945,7 +2948,7 @@ retry:
ret = get_hwpoison_page(page, flags | MF_SOFT_OFFLINE);
put_online_mems();
- if (hwpoison_filter(page)) {
+ if (hwpoison_filter(page) || PageNonFolioCompound(page)) {
if (ret > 0)
put_page(page);
_
Patches currently in -mm which might be from ziy@nvidia.com are
mm-memory_failure-reject-unsupported-non-folio-compound-page.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-05 1:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05 1:07 + mm-memory_failure-reject-unsupported-non-folio-compound-page.patch added to mm-hotfixes-unstable branch Andrew Morton
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.