On Wed, 7 Sep 2022 19:35:10 -0700 Shakeel Butt <shakeelb@xxxxxxxxxx> wrote: > On Tue, Sep 6, 2022 at 9:36 PM Shakeel Butt <shakeelb@xxxxxxxxxx> wrote: > > > [...] > > > > static unsigned long memcg_events_local(struct mem_cgroup *memcg, int event) > > { > > long x = 0; > > int cpu; > > + int index = memcg_events_index(event); > > + > > + if (index < 0) > > + return 0; > > > > for_each_possible_cpu(cpu) > > x += per_cpu(memcg->vmstats_percpu->events[event], cpu); > > Andrew, can you please replace 'event' in the above line with 'index'? > I had this correct in the original single patch but messed up while > breaking up that patch into three patches for easier review. No probs. From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: memcg-reduce-size-of-memcg-vmstats-structures-fix Date: Thu Sep 8 03:35:53 PM PDT 2022 fix memcg_events_local() array index, per Shakeel Link: https://lkml.kernel.org/r/CALvZod70Mvxr+Nzb6k0yiU2RFYjTD=0NFhKK-Eyp+5ejd1PSFw@xxxxxxxxxxxxxx Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Muchun Song <songmuchun@xxxxxxxxxxxxx> Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memcontrol.c~memcg-reduce-size-of-memcg-vmstats-structures-fix +++ a/mm/memcontrol.c @@ -921,7 +921,7 @@ static unsigned long memcg_events_local( return 0; for_each_possible_cpu(cpu) - x += per_cpu(memcg->vmstats_percpu->events[event], cpu); + x += per_cpu(memcg->vmstats_percpu->events[index], cpu); return x; } _