Skip to contentSkip to conversation

mm/damon/vaddr: fix missing pte_unmap_unlock in damos_va_migrate_pmd_entry()

PATCH Applied Akinobu Mita 2 participants 2 messages Dec 9, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/damon/vaddr: fix missing pte_unmap_unlock in damos_va_migrate_pmd_entry()

If the PTE page table lock is acquired by pte_offset_map_lock(), the lock must be released via pte_unmap_unlock().

However, in damos_va_migrate_pmd_entry(), if damos_va_filter_out() returns true, it immediately returns without releasing the lock.

This fixes the issue by not stopping page table traversal when damos_va_filter_out() returns true and ensuring that the lock is released.

Fixes 09efc56a3b1c ("mm/damon/vaddr: consistently use only pmd_entry for damos_migrate")
---
 mm/damon/vaddr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/vaddr.c +1 -1
index 2750c88e7225..23ed738a0bd6 100644
@@ -743,7 +743,7 @@ static int damos_va_migrate_pmd_entry(pmd_t *pmd, unsigned long addr,
 		if (!folio)
 			continue;
 		if (damos_va_filter_out(s, folio, walk->vma, addr, pte, NULL))
-			return 0;
+			continue;
 		damos_va_migrate_dests_add(folio, walk->vma, addr, dests,
 				migration_lists);
 		nr = folio_nr_pages(folio);
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Wed, 10 Dec 2025 00:10:34 +0900 Akinobu Mita <[email protected]> wrote:

If the PTE page table lock is acquired by pte_offset_map_lock(), the lock must be released via pte_unmap_unlock().

However, in damos_va_migrate_pmd_entry(), if damos_va_filter_out() returns true, it immediately returns without releasing the lock.

This fixes the issue by not stopping page table traversal when damos_va_filter_out() returns true and ensuring that the lock is released.

Thank you for finding and fixing this!

Quoted 3 lines
Fixes 09efc56a3b1c ("mm/damon/vaddr: consistently use only pmd_entry for damos_migrate")

Thanks,
SJ

[...]