Re: [PATCH 1/7] memcg: move v1 only percpu stats in separate struct
From: Roman Gushchin
Date: Thu Aug 15 2024 - 15:34:47 EST
On Wed, Aug 14, 2024 at 10:04:47PM -0700, Shakeel Butt wrote:
> At the moment struct memcg_vmstats_percpu contains two v1 only fields
> which consumes memory even when CONFIG_MEMCG_V1 is not enabled. In
> addition there are v1 only functions accessing them and are in the main
> memcontrol source file and can not be moved to v1 only source file due
> to these fields. Let's move these fields into their own struct. Later
> patches will move the functions accessing them to v1 source file and
> only allocate these fields when CONFIG_MEMCG_V1 is enabled.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> ---
> include/linux/memcontrol.h | 2 ++
> mm/memcontrol-v1.h | 19 +++++++++++++++++++
> mm/memcontrol.c | 18 +++++++++---------
> 3 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 90ecd2dbca06..e21a1541adeb 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -70,6 +70,7 @@ struct mem_cgroup_id {
> };
>
> struct memcg_vmstats_percpu;
> +struct memcg1_events_percpu;
> struct memcg_vmstats;
> struct lruvec_stats_percpu;
> struct lruvec_stats;
> @@ -254,6 +255,7 @@ struct mem_cgroup {
> struct list_head objcg_list;
>
> struct memcg_vmstats_percpu __percpu *vmstats_percpu;
> + struct memcg1_events_percpu __percpu *events_percpu;
It wasn't really obvious until the patch [6/7] why it's not
under CONFIG_MEMCG_V1, but otherwise the series looks great to me.
Acked-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>
for the whole series.
Thank you!