Re: [PATCH v3 0/3] mm: handle device-private PMDs in walk callbacks

From: Andrew Morton

Date: Fri Jul 10 2026 - 19:53:57 EST


On Fri, 10 Jul 2026 03:55:20 -0700 Usama Arif <usama.arif@xxxxxxxxx> wrote:

> 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.

Added, thanks.

I didn't add these as hotfixes - the Fixes: commit is somewhat old.
Feel free to disagree with this!

Sashiko went nuts over possible pre-existing issues:

https://sashiko.dev/#/patchset/20260710105557.1987433-1-usama.arif@xxxxxxxxx