Skip to contentSkip to conversation

mm-khugepaged-fix-iteration-in-collapse_file.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jun 19, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/khugepaged: fix iteration in collapse_file
has been removed from the -mm tree. Its filename was
mm-khugepaged-fix-iteration-in-collapse_file.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: David Stevens <[email protected]>
Subject: mm/khugepaged: fix iteration in collapse_file
Date: Wed, 7 Jun 2023 14:31:35 +0900

Remove an unnecessary call to xas_set(index) when iterating over the target range in collapse_file. The extra call to xas_set reset the xas cursor to the top of the tree, causing the xas_next call on the next iteration to walk the tree to index instead of advancing to index+1. This returned the same page again, which would cause collapse_file to fail because the page is already locked.

This bug was hidden when CONFIG_DEBUG_VM was set. When that config was used, the xas_load in a subsequent VM_BUG_ON assert would walk xas from the top of the tree to index, causing the xas_next call on the next loop iteration to advance the cursor as expected.

Fixes a2e17cc2efc7 ("mm/khugepaged: maintain page cache uptodate flag")
Cc David Hildenbrand <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Jiaqi Yan <[email protected]>
Cc Kirill A . Shutemov <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Yang Shi <[email protected]>
Cc Mike Kravetz <[email protected]>

---

 mm/khugepaged.c |    1 -
 1 file changed, 1 deletion(-)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-khugepaged-fix-iteration-in-collapse_file +0 -1
@@ -2070,7 +2070,6 @@ static int collapse_file(struct mm_struc
 					TTU_IGNORE_MLOCK | TTU_BATCH_FLUSH);
 
 		xas_lock_irq(&xas);
-		xas_set(&xas, index);
 
 		VM_BUG_ON_PAGE(page != xas_load(&xas), page);
 

_

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

mm-shmem-fix-race-in-shmem_undo_range-w-thp.patch