Re: [PATCH v10 16/37] mm: alloc_swap_folio: pass raw fault address to vma_alloc_folio
From: Lorenzo Stoakes
Date: Mon Jun 08 2026 - 07:44:11 EST
On Mon, Jun 08, 2026 at 04:37:41AM -0400, Michael S. Tsirkin wrote:
> Same change as the previous patch but for alloc_swap_folio:
Please don't say 'same change as the previous patch' :) explain what you're
doing here. It's a pain to have to go check otherwise.
> pass vmf->address directly instead of ALIGN_DOWN(vmf->address, ...).
>
> Note: NUMA interleave is not affected by the raw address;
> the ilx calculation shifts addr >> PAGE_SHIFT >> order,
> dropping sub-page bits regardless of alignment.
You're expressing the same thing as the last patch differently, but then
eliding other explanations from that?
All the same questions as I asked for the last apply to this also.
And also - if you've now made this a _requirement_ that is broken
otherwise, then aren't these bisection hazards and should be squashed into
the change?...
No patch should break anything at any point.
>
> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>
> 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 21f640674c4f..6c14b90f558e 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4750,8 +4750,7 @@ static struct folio *alloc_swap_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);
> - folio = vma_alloc_folio(gfp, order, vma, addr);
> + folio = vma_alloc_folio(gfp, order, vma, vmf->address);
> if (folio) {
> if (!mem_cgroup_swapin_charge_folio(folio, vma->vm_mm,
> gfp, entry))
> --
> MST
>
Thanks, Lorenzo