Re: [PATCH 1/8] mm/huge_memory: simplify vma_is_specal_huge()

From: Lorenzo Stoakes (Oracle)

Date: Thu Mar 19 2026 - 10:10:14 EST


On Thu, Mar 19, 2026 at 02:03:04PM +0100, David Hildenbrand (Arm) wrote:
> On 3/19/26 11:34, Lorenzo Stoakes (Oracle) wrote:
> > On Wed, Mar 18, 2026 at 09:45:31PM +0100, David Hildenbrand (Arm) wrote:
> >>> +++ b/mm/huge_memory.c
> >>> @@ -100,6 +100,14 @@ static inline bool file_thp_enabled(struct vm_area_struct *vma)
> >>> return !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode);
> >>> }
> >>>
> >>> +/* If returns true, we are unable to access the VMA's folios. */
> >>> +static bool vma_is_special_huge(struct vm_area_struct *vma)
> >>> +{
> >>> + if (vma_is_dax(vma))
> >>> + return false;
> >>> + return vma_test_any(vma, VMA_PFNMAP_BIT, VMA_MIXEDMAP_BIT);
> >>> +}
> >>
> >> I was hoping that we could make this whole code look more like PTE code
> >> by using vm_normal_page_pmd() ... :)
> >
> > Could that be a follow up?
>
> I guess so, but the code is so awful :(

well I udated the code to use vm_normal_folio_pmd() :) at least should get
us closer to common logic.

Cheers, Lorenzo