Re: [PATCH v3 0/3] mm: handle device-private PMDs in walk callbacks
From: Balbir Singh
Date: Sun Jul 12 2026 - 21:33:45 EST
On Fri, Jul 10, 2026 at 04:53:48PM -0700, Andrew Morton wrote:
> 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.
>
Thanks Andrew!
> 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
>
The pointed out seems plausible? I am working on some tests to catch
more errors via hmm-tests.
Balbir