The commit is pushed to "branch-rh9-5.14.0-427.77.1.vz9.86.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh9-5.14.0-427.77.1.vz9.86.5 ------> commit 3295297e295a218f2ea90c881a1365f6cee1c287 Author: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Date: Fri Aug 15 16:57:15 2025 +0800
mm/memcontrol: fix non functioning swapin/out stats We count PSWPIN/OUT events via this code path: +-> count_memcg_page_event(folio, PSWPIN) +-> count_memcg_events(PSWPIN) +-> __count_memcg_events(PSWPIN) +-> index = memcg_events_index(idx=PSWPIN) +-> return mem_cgroup_events_index[idx] - 1 +-> if (index >= 0) +-> __this_cpu_add(memcg->vmstats_percpu->events[i], count) And before that patch mem_cgroup_events_index[PSWPIN/OUT] was 0, which is "BAD" and leads to doing nothing. Fix that by adding PSWPIN/OUT to memcg_vm_event_stat. One more benefit from this change is that those stats are now also available in cgroup-v2 memory.stat file. Note though, that cgroup-v2 event stats are printed via memcg_events and cgroup-v1 event stats are printed via memcg_events_local, so in v2 we have total sum of stats in all cgroup subdirectories, not just one cgroup. Fixes: 775cb9c41e708 ("mm: memcontrol: add swapin/out stats") Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Feature: mm: statistic enhancements --- mm/memcontrol.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index cefb72234fda5..1b55b6d02d372 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -736,6 +736,8 @@ static const unsigned int memcg_vm_event_stat[] = { THP_FAULT_ALLOC, THP_COLLAPSE_ALLOC, #endif + PSWPIN, + PSWPOUT, }; #define NR_MEMCG_EVENTS ARRAY_SIZE(memcg_vm_event_stat) _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel