Re: [PATCH] memcg: vmalloc: simplify MEMCG_VMALLOC updates
From: Johannes Weiner
Date: Thu Apr 03 2025 - 12:47:52 EST
On Wed, Apr 02, 2025 at 10:33:26PM -0700, Shakeel Butt wrote:
> The vmalloc region can either be charged to a single memcg or none. At
> the moment kernel traverses all the pages backing the vmalloc region to
> update the MEMCG_VMALLOC stat. However there is no need to look at all
> the pages as all those pages will be charged to a single memcg or none.
> Simplify the MEMCG_VMALLOC update by just looking at the first page of
> the vmalloc region.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
It's definitely pointless to handle each page with the stat being
per-cgroup only. But I do wonder why it's not a regular vmstat item.
There is no real reason it *should* be a private memcg stat, is there?