Re: [PATCH v7 13/31] mm: alloc_swap_folio: pass raw fault address to vma_alloc_folio

From: Gregory Price

Date: Thu May 14 2026 - 10:00:20 EST


On Tue, May 12, 2026 at 05:06:16PM -0400, Michael S. Tsirkin wrote:
> Same change as the previous patch but for alloc_swap_folio:
> pass vmf->address directly instead of ALIGN_DOWN(vmf->address, ...).
>

Rather than reference other patches, just explain the contents of this
patch. otherwise...

> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> Assisted-by: Claude:claude-opus-4-6
> Assisted-by: cursor-agent:GPT-5.4-xhigh

Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>

> ---
> mm/memory.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 0824441a6ba1..74523bc00d8a 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4734,8 +4734,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
>