* + mm-shmem-ignore-sysfs-configs-for-shmem-forced-collapse.patch added to mm-hotfixes-unstable branch
@ 2026-09-14 2:44 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-09-14 2:44 UTC (permalink / raw)
To: mm-commits, ziy, ryan.roberts, ljs, liam, lance.yang, kas, hughd,
dev.jain, david, baohua, baolin.wang, akpm
The patch titled
Subject: mm: shmem: ignore sysfs configs for shmem forced collapse
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-shmem-ignore-sysfs-configs-for-shmem-forced-collapse.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shmem-ignore-sysfs-configs-for-shmem-forced-collapse.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: Baolin Wang <baolin.wang@linux.alibaba.com>
Subject: mm: shmem: ignore sysfs configs for shmem forced collapse
Date: Mon, 14 Sep 2026 10:12:41 +0800
According to Documentation/mm/transhuge.rst, MADV_COLLAPSE is expected to
ignore any THP or mTHP interface settings.
However, after commit 26c7d8413aaf ("mm: thp: support "THPeligible"
semantics for mTHP with anonymous shmem"), performing MADV_COLLAPSE on
shmem will depend on /sys/.../hugepages-2048kB/shmem_enabled being set to
"inherit" (although that is the default), which can cause MADV_COLLAPSE to
fail unexpectedly.
Fix this by returning the result of shmem_huge_global_enabled() directly
when MADV_COLLAPSE is requested, allowing PMD-order collapse while
ignoring shmem THP/mTHP settings.
Link: https://lore.kernel.org/063f655b4d6c4234f3aa27ed6ecab10283ecb880.1789351825.git.baolin.wang@linux.alibaba.com
Fixes: 26c7d8413aaf ("mm: thp: support "THPeligible" semantics for mTHP with anonymous shmem")
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Closes: https://lore.kernel.org/all/20260908125105.1510704-7-kirill@shutemov.name/
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Acked-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Reviewed-by: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
---
mm/shmem.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/mm/shmem.c~mm-shmem-ignore-sysfs-configs-for-shmem-forced-collapse
+++ a/mm/shmem.c
@@ -1847,8 +1847,11 @@ unsigned long shmem_allowable_huge_order
global_orders = shmem_huge_global_enabled(inode, index, write_end,
shmem_huge_force, vma, vm_flags);
- /* Tmpfs huge pages allocation */
- if (!vma || !vma_is_anon_shmem(vma))
+ /*
+ * Tmpfs huge pages allocation or forced collapse ignores
+ * sysfs configs.
+ */
+ if (!vma || !vma_is_anon_shmem(vma) || shmem_huge_force)
return global_orders;
/*
_
Patches currently in -mm which might be from baolin.wang@linux.alibaba.com are
maintainers-add-baoquan-and-me-as-mglru-reviewers.patch
mm-shmem-ignore-sysfs-configs-for-shmem-forced-collapse.patch
mm-mglru-clear-the-reference-counter-for-rejected-folios.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-14 2:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 2:44 + mm-shmem-ignore-sysfs-configs-for-shmem-forced-collapse.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.