mm-mempolicy-skip-non-present-pmds-when-queueing-folios.patch removed from -mm tree
The quilt patch titled
Subject: mm/mempolicy: skip non-present PMDs when queueing folios
has been removed from the -mm tree. Its filename was
mm-mempolicy-skip-non-present-pmds-when-queueing-folios.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Usama Arif <[email protected]>
Subject: mm/mempolicy: skip non-present PMDs when queueing folios
Date: Fri, 10 Jul 2026 03:55:21 -0700
Patch series "mm: handle device-private PMDs in walk callbacks", v3.
Since commit 368076f52ebe ("mm/huge_memory: add device-private THP support to PMD operations") a PMD may hold a device-private swap entry whenever an HMM-based GPU driver migrates an anonymous THP folio to device memory via migrate_vma_pages().
pmd_trans_huge_lock() succeeds for such PMDs (pmd_is_huge() returns true for any non-present, non-none huge PMD), so several MM walk callbacks that used to assume present THP or migration entry are now reachable with a device-private PMD. The results range from a VM_BUG_ON() firing on debug kernels, to an oops on a bogus vmemmap dereference, to silently isolating an unrelated live folio from LRU in the aliasing case.
This patch (of 3):
queue_folios_pmd() is called under pmd_trans_huge_lock(), whose pmd_is_huge() check returns true for any non-present, non-none PMD softleaf. Passing such a PMD to pmd_folio() treats the softleaf encoding as a hardware PFN and can return a bogus folio pointer.
Mirror queue_folios_pte_range(): handle non-present entries before looking up a folio. Keep migration entries counted as failures, but skip other non-present PMDs such as device-private entries.
Potential trigger: an HMM-based GPU driver migrates an anonymous THP folio to device memory via migrate_vma_pages(), leaving a device-private PMD. Userspace then calls mbind(), migrate_pages() or set_mempolicy_home_node() on that range.
---
mm/mempolicy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
mm/mempolicy.c renamed from mm/mempolicy.c~mm-mempolicy-skip-non-present-pmds-when-queueing-folios +5 -3
@@ -654,12 +654,14 @@ static void queue_folios_pmd(pmd_t *pmd, {struct folio *folio;struct queue_pages *qp = walk->private; +pmd_t pmdval =pmdp_get (pmd); -if (unlikely (pmd_is_migration_entry (*pmd))) { - qp->nr_failed++; +if (unlikely (!pmd_present (pmdval))) { +if (pmd_is_migration_entry (pmdval)) + qp->nr_failed++;return ; } - folio =pmd_folio (*pmd); + folio =pmd_folio (pmdval);if (is_huge_zero_folio (folio)) { walk->action =ACTION_CONTINUE ;return ;
_
Patches currently in -mm which might be from [email protected] are
mm-vmstat-mm-memcontrol-add-_monotonic-vmstat-readers.patch mm-vmscan-add-pgrotate_anon-and-pgrotate_file-vmstat-counters.patch mm-vmscan-reduce-lru_lock-contention-via-vmstat-derived-scan-balance-cost.patch