Re: [PATCH v5 1/3] mm/vmalloc: extract vm_area_free_pages() helper from vfree()

From: Alice Ryhl

Date: Tue Mar 17 2026 - 10:30:08 EST


On Tue, Mar 17, 2026 at 01:47:33PM +0530, Shivam Kalra wrote:
> Extract the page-freeing loop and NR_VMALLOC stat accounting from
> vfree() into a reusable vm_area_free_pages() helper. The helper operates
> on a range [start, end) of pages from a vm_struct, making it suitable
> for both full free (vfree) and partial free (upcoming vrealloc shrink).
>
> Freed page pointers in vm->pages[] are set to NULL to prevent stale
> references when the vm_struct outlives the free (as in vrealloc shrink).
>
> Signed-off-by: Shivam Kalra <shivamkalra98@xxxxxxxxxxx>

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>