Skip to contentSkip to conversation

khugepaged-collapse_pte_mapped_thp-flush-the-right-range.patch removed from -mm tree

merged [email protected] 1 participant 1 message Aug 10, 2020 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: khugepaged: collapse_pte_mapped_thp() flush the right range
has been removed from the -mm tree. Its filename was
khugepaged-collapse_pte_mapped_thp-flush-the-right-range.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Hugh Dickins <[email protected]>
Subject: khugepaged: collapse_pte_mapped_thp() flush the right range

pmdp_collapse_flush() should be given the start address at which the huge page is mapped, haddr: it was given addr, which at that point has been used as a local variable, incremented to the end address of the extent.

Found by source inspection while chasing a hugepage locking bug, which I then could not explain by this. At first I thought this was very bad; then saw that all of the page translations that were not flushed would actually still point to the right pages afterwards, so harmless; then realized that I know nothing of how different architectures and models cache intermediate paging structures, so maybe it matters after all - particularly since the page table concerned is immediately freed.

Much easier to fix than to think about.

Fixes 27e1f8273113 ("khugepaged: enable collapse pmd for pte-mapped THP")
Cc Andrea Arcangeli <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Song Liu <[email protected]>
Cc <[email protected]> [5.4+]

---

 mm/khugepaged.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/khugepaged.c renamed from mm/khugepaged.c~khugepaged-collapse_pte_mapped_thp-flush-the-right-range +1 -1
@@ -1502,7 +1502,7 @@ void collapse_pte_mapped_thp(struct mm_s
 
 	/* step 4: collapse pmd */
 	ptl = pmd_lock(vma->vm_mm, pmd);
-	_pmd = pmdp_collapse_flush(vma, addr, pmd);
+	_pmd = pmdp_collapse_flush(vma, haddr, pmd);
 	spin_unlock(ptl);
 	mm_dec_nr_ptes(mm);
 	pte_free(mm, pmd_pgtable(_pmd));

_

Patches currently in -mm which might be from [email protected] are