* FAILED: patch "[PATCH] mm/khugepaged: don't map folios that are not uptodate in" failed to apply to 6.1-stable tree
@ 2026-12-02 13:16 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2026-12-02 13:16 UTC (permalink / raw)
To: david, baolin.wang, hughd, kas, lance.yang, ljs, mason, pfalcato,
sj, ziy, zokeefe
Cc: stable
The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 043a2260b96ffc13121a1dd65282e67eb2e1d8a8
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120243-sedate-penny-9d9e@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 043a2260b96ffc13121a1dd65282e67eb2e1d8a8 Mon Sep 17 00:00:00 2001
From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: Thu, 5 Nov 2026 19:16:44 +0100
Subject: [PATCH] mm/khugepaged: don't map folios that are not uptodate in
MADV_COLLAPSE
madvise(MADV_COLLAPSE) can map PMD-sized pagecache folios that are not
uptodate. For example, shmem fallocate() can put such folios into the
page cache.
collapse_file() already refuses to proceed with folios that are not
uptodate. Let's just do the same in try_collapse_pte_mapped_thp() and skip
such folios, leaving handling to the page faults.
Note that collapse_file() effectively clears shmem folios through
shmem_get_folio(); let's keep this fix simple and simply let the page
fault path deal with that.
Fixes: 34488399fa08 ("mm/madvise: add file and shmem support to MADV_COLLAPSE")
Reported-by: Chris Mason <mason@kernel.org>
Cc: stable@vger.kernel.org
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Hugh Dickins <hughd@google.com>
Acked-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Zach O'Keefe <zokeefe@google.com>
Reviewed-by: SJ Park <sj@kernel.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Link: https://patch.msgid.link/20261105-set_huge_pmd_uptodate-v1-1-a78d8a1b7117@kernel.org
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 4bbe319ef86f..964f78c3856b 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1888,6 +1888,12 @@ static enum scan_result try_collapse_pte_mapped_thp(struct mm_struct *mm, unsign
goto drop_folio;
}
+ /* Leave any uninitialized folios to the page fault path. */
+ if (!folio_test_uptodate(folio)) {
+ result = SCAN_FAIL;
+ goto drop_folio;
+ }
+
result = find_pmd_or_thp_or_none(mm, haddr, &pmd);
switch (result) {
case SCAN_SUCCEED:
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 14:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 13:16 FAILED: patch "[PATCH] mm/khugepaged: don't map folios that are not uptodate in" failed to apply to 6.1-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox