From: Shakeel Butt <shakeel.butt@linux.dev>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Uladzislau Rezki <urezki@gmail.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>,
Michal Hocko <mhocko@suse.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: vmalloc: streamline vmalloc memory accounting
Date: Fri, 20 Feb 2026 14:09:28 -0800 [thread overview]
Message-ID: <aZjaxAi-AzyOYzNT@linux.dev> (raw)
In-Reply-To: <20260220191035.3703800-1-hannes@cmpxchg.org>
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.
> +
> split_page(page, large_order);
> for (i = 0; i < (1U << large_order); i++)
> pages[nr_allocated + i] = page + i;
> @@ -3675,6 +3671,7 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> if (!order) {
> while (nr_allocated < nr_pages) {
> unsigned int nr, nr_pages_request;
> + int i;
>
> /*
> * A maximum allowed request is hard-coded and is 100
> @@ -3698,6 +3695,9 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> nr_pages_request,
> pages + nr_allocated);
>
> + for (i = nr_allocated; i < nr_allocated + nr; i++)
> + inc_node_page_state(pages[i], NR_VMALLOC);
> +
> nr_allocated += nr;
>
> /*
> @@ -3722,6 +3722,8 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> if (unlikely(!page))
> break;
>
> + mod_node_page_state(page, NR_VMALLOC, 1 << order);
Same here.
With above fixes, you can add:
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
next prev parent reply other threads:[~2026-02-20 22:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 19:10 [PATCH 1/2] mm: vmalloc: streamline vmalloc memory accounting Johannes Weiner
2026-02-20 19:10 ` [PATCH 2/2] mm: memcontrol: switch to native NR_VMALLOC vmstat counter Johannes Weiner
2026-02-20 22:15 ` Shakeel Butt
2026-02-23 15:12 ` Uladzislau Rezki
2026-02-20 22:09 ` Shakeel Butt [this message]
2026-02-23 15:58 ` [PATCH 1/2] mm: vmalloc: streamline vmalloc memory accounting Johannes Weiner
2026-02-23 15:30 ` Uladzislau Rezki
2026-02-23 20:19 ` Johannes Weiner
2026-02-24 18:03 ` Uladzislau Rezki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZjaxAi-AzyOYzNT@linux.dev \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.