Re: [PATCH] mm/huge_memory: bypass THP tuneables for huge pfnmap mappings

From: Lorenzo Stoakes (ARM)

Date: Fri Aug 28 2026 - 13:20:59 EST


On Fri, Aug 28, 2026 at 09:46:49AM -0700, Saravanan D wrote:
> On Thu, Aug 27, 2026 at 08:55:57PM +0100, Lorenzo Stoakes (ARM) wrote:
> > This is incorrect - if a huge PFN map is available (defined by
> > vma->vm_ops->huge_fault being non-NULL for a VMA_PFNMAP_BIT VMA), then it
> > should be mapped huge upon fault-in.
> [...]
> > Correct this by explicitly checking for this while ensuring that smaps
> > continues to accurately report THPeligible statistics.
>
> I backported this to a 6.17 based kernel and tested it under
> cloud-hypervisor with THP left at the Ubuntu default of madvise, on
> two GPU generations:
>
> - 4x H100, 128 GiB BAR1 each
> - 8x B300, 512 GiB BAR1 each
>
> With the patch every BAR faults in entirely at PUD (1 GiB)
> granularity, one entry per GiB of BAR, so 128 for each H100 BAR and
> 512 for each B300 BAR, and smaps reports THPeligible: 1 for every
> vfio-device VMA. Total time in the huge_fault path was 4.5 ms on the
> H100 node and 130 ms on the B300 node, and the VMs booted in 11.6s
> and 32s respectively.
>
> Tested-by: Saravanan D <saravanand@xxxxxxxxx>

Thanks! Appreciate the testing :) and glad this helps your usecase.

--
Cheers, Lorenzo