Re: [PATCH 1/2] mm: vmalloc: streamline vmalloc memory accounting
From: Johannes Weiner
Date: Mon Feb 23 2026 - 10:59:11 EST
On Fri, Feb 20, 2026 at 02:09:28PM -0800, Shakeel Butt wrote:
> On Fri, Feb 20, 2026 at 02:10:34PM -0500, Johannes Weiner wrote:
> [...]
> > static struct vmap_area *__find_vmap_area(unsigned long addr, struct rb_root *root)
> > {
> > struct rb_node *n = root->rb_node;
> > @@ -3463,11 +3457,11 @@ void vfree(const void *addr)
> > * High-order allocs for huge vmallocs are split, so
> > * can be freed as an array of order-0 allocations
> > */
> > + if (!(vm->flags & VM_MAP_PUT_PAGES))
> > + dec_node_page_state(page, NR_VMALLOC);
> > __free_page(page);
> > cond_resched();
> > }
> > - if (!(vm->flags & VM_MAP_PUT_PAGES))
> > - atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages);
> > kvfree(vm->pages);
> > kfree(vm);
> > }
> > @@ -3655,6 +3649,8 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> > continue;
> > }
> >
> > + mod_node_page_state(page, NR_VMALLOC, 1 << large_order);
>
> mod_node_page_state() takes 'struct pglist_data *pgdat', you need to use
> page_pgdat(page) as first param.
Good catch, my apologies. Serves me right for not compiling
incrementally.
> With above fixes, you can add:
>
> Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
Thanks! I'll send out v2.