mm-compaction-fix-bug-in-hugetlb-handling-pathway.patch removed from -mm tree
The quilt patch titled
Subject: mm/compaction: fix bug in hugetlb handling pathway
has been removed from the -mm tree. Its filename was
mm-compaction-fix-bug-in-hugetlb-handling-pathway.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Vishal Moola (Oracle)" <[email protected]>
Subject: mm/compaction: fix bug in hugetlb handling pathway
Date: Mon, 31 Mar 2025 19:10:24 -0700
The compaction code doesn't take references on pages until we're certain we should attempt to handle it.
In the hugetlb case, isolate_or_dissolve_huge_page() may return -EBUSY without taking a reference to the folio associated with our pfn. If our folio's refcount drops to 0, compound_nr() becomes unpredictable, making low_pfn and nr_scanned unreliable. The user-visible effect is minimal - this should rarely happen (if ever).
Fix this by storing the folio statistics earlier on the stack (just like the THP and Buddy cases).
Also revert commit 66fe1cf7f581 ("mm: compaction: use helper compound_nr in isolate_migratepages_block") to make backporting easier.
---
mm/compaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/compaction.c renamed from mm/compaction.c~mm-compaction-fix-bug-in-hugetlb-handling-pathway +3 -3
@@ -981,13 +981,13 @@ isolate_migratepages_block(struct compac }if (PageHuge (page)) { +const unsigned int order =compound_order (page);/* * skip hugetlbfs if we are not compacting for pages * bigger than its order. THPs and other compound pages * are handled below. */ if (!cc->alloc_contig) { -const unsigned int order =compound_order (page);if (order <=MAX_PAGE_ORDER ) { low_pfn += (1UL << order) -1 ;
@@ -1011,8 +1011,8 @@ isolate_migratepages_block(struct compac/* Do not report -EBUSY down the chain */ if (ret == -EBUSY ) ret =0 ; - low_pfn +=compound_nr (page) -1 ; - nr_scanned +=compound_nr (page) -1 ; + low_pfn += (1UL << order) -1 ; + nr_scanned += (1UL << order) -1 ; goto isolate_fail; }
_
Patches currently in -mm which might be from [email protected] are
mm-compaction-use-folio-in-hugetlb-pathway.patch