On Mon, Apr 29, 2024 at 02:02:23PM -0700, Roman Gushchin wrote: > On Mon, Apr 29, 2024 at 12:46:32PM -0700, Shakeel Butt wrote: > > On Mon, Apr 29, 2024 at 08:50:11AM -0700, Roman Gushchin wrote: > > > On Fri, Apr 26, 2024 at 05:37:28PM -0700, Shakeel Butt wrote: > > [...] > > > > > > + return x; > > > > +} > > > > + > > > > /* Subset of vm_event_item to report for memcg event stats */ > > > > static const unsigned int memcg_vm_event_stat[] = { > > > > PGPGIN, > > > > @@ -5492,18 +5546,25 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) > > > > if (!pn) > > > > return 1; > > > > > > > > + pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats), GFP_KERNEL, > > > > + node); > > > > > > Why not GFP_KERNEL_ACCOUNT? > > > > > > > Previously struct lruvec_stats was part of struct mem_cgroup_per_node > > and we use GFP_KERNEL to allocate struct mem_cgroup_per_node. I kept the > > behavior same and if we want to switch to GFP_KERNEL_ACCOUNT, I think it > > should be a separate patch. > > Agree. Here is the patch: Awesome, I will pull this in my v3 post. > > -- > > From fd6854c0b272c5314bce6c9dee7d3c8f8cee3a86 Mon Sep 17 00:00:00 2001 > From: Roman Gushchin <roman.gushchin@xxxxxxxxx> > Date: Mon, 29 Apr 2024 13:57:26 -0700 > Subject: [PATCH] mm: memcg: account memory used for memcg vmstats and lruvec > stats > > The percpu memory used by memcg's memory statistics is already accounted. > For consistency, let's enable accounting for vmstats and lruvec stats > as well. > > Signed-off-by: Roman Gushchin <roman.gushchin@xxxxxxxxx> Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx> > --- > mm/memcontrol.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index d11536ef59ef..2fe25d49cfaa 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -5661,8 +5661,8 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) > if (!pn) > return 1; > > - pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats), GFP_KERNEL, > - node); > + pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats), > + GFP_KERNEL_ACCOUNT, node); > if (!pn->lruvec_stats) > goto fail; > > @@ -5733,7 +5733,8 @@ static struct mem_cgroup *mem_cgroup_alloc(struct mem_cgroup *parent) > goto fail; > } > > - memcg->vmstats = kzalloc(sizeof(struct memcg_vmstats), GFP_KERNEL); > + memcg->vmstats = kzalloc(sizeof(struct memcg_vmstats), > + GFP_KERNEL_ACCOUNT); > if (!memcg->vmstats) > goto fail; > > -- > 2.43.2 >