On Mon, Jun 08, 2026 at 04:37:25AM -0400, Michael S. Tsirkin wrote: > Pass vmf->address directly instead of ALIGN_DOWN(vmf->address, ...). > NUMA interleave is not affected: the ilx calculation in > get_vma_policy() shifts addr >> PAGE_SHIFT >> order, which > drops sub-page bits regardless of alignment. post_alloc_hook > will use the raw address for cache-friendly zeroing via > folio_zero_user().
I'm confused as to the justification for this? You're saying 'make change X, it's safe because Y'. So the justification is now this post_alloc_hook thing. But are you now creating a new requirement of vma_alloc_folio() that you must specify the actual address we are faulting on, not an address within the folio or the folio's base address? (If that's a requirement, why is it?) If so you should update the vma_alloc_folio() description 'virtual address of the allocation' is not at all clear. And if that _is_ a requirement, then are you sure all allocation paths are correct? I already see addr & HPAGE_PMD_MASK in vma_alloc_anon_folio_pmd() for instance? If it's not a requirement, why are we doing this? it's surely useless in that case? > > Signed-off-by: Michael S. Tsirkin <[email protected]> > Reviewed-by: Gregory Price <[email protected]> > Assisted-by: Claude:claude-opus-4-6 > Assisted-by: cursor-agent:GPT-5.4-xhigh > --- > mm/memory.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 86a973119bd4..21f640674c4f 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -5268,8 +5268,7 @@ static struct folio *alloc_anon_folio(struct vm_fault > *vmf) > /* Try allocating the highest of the remaining orders. */ > gfp = vma_thp_gfp_mask(vma); > while (orders) { > - addr = ALIGN_DOWN(vmf->address, PAGE_SIZE << order); If you're removing this usage, could you also remove the silly thing of us declaring this at function scope then using it in branches when we should always have declared these separately? > - folio = vma_alloc_folio(gfp, order, vma, addr); > + folio = vma_alloc_folio(gfp, order, vma, vmf->address); > if (folio) { > if (mem_cgroup_charge(folio, vma->vm_mm, gfp)) { > count_mthp_stat(order, > MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE); > -- > MST > Thanks, Lorenzo

