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

Alice Ryhl
2026-03-17T14:17:00Z

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@zohomail.in>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>