[PATCH v2 08/14] mm/khugepaged: Remove redundant pmd_devmap() check
Alistair Popple
apopple at nvidia.com
Thu Jun 19 17:56:14 AEST 2025
On Tue, Jun 17, 2025 at 11:44:30AM +0200, David Hildenbrand wrote:
> On 16.06.25 13:58, Alistair Popple wrote:
> > The only users of pmd_devmap were device dax and fs dax. The check for
> > pmd_devmap() in check_pmd_state() is therefore redundant as callers
> > explicitly check for is_zone_device_page(), so this check can be dropped.
> >
>
> Looking again, is this true?
>
> If we return "SCAN_SUCCEED", we assume there is a page table there that we
> can map and walk.
>
> But I assume we can drop that check because nobody will ever set
> pmd_devmap() anymore?
>
> So likely just the description+sibject of this patch should be adjusted.
Ugh. I wish I had've documented this better because it's all very "obvious",
but I think the description is still accurate. These devmap checks could never
have been hit and were therefore redundant, because in practice all callers call
thp_vma_allowable_order() either before or after check_pmd_state() (or both).
thp_vma_allowable_order() will eventually (in __thp_vma_allowable_orders())
check for a DAX VMA and bail. But yes, I should call that out in the patch
subject so I don't have to keep relearning this obvious fact :-)
> FWIW, I think check_pmd_state() should be changed to work on pmd_leaf() etc,
> but that's something for another day.
Sure, and I do appreciate these kind of remarks because sometimes I get bored
enough to come back and actually do them. Not very often ... but sometimes.
> --
> Cheers,
>
> David / dhildenb
>
More information about the Linuxppc-dev
mailing list