[Devel] [PATCH RHEL8 COMMIT] ve/memcg: Fix /proc/vmstat virtualization (drop extra recursion)
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Jul 27 13:00:18 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.60
------>
commit a31086ba8fb0bd50bea7105e3e9d3628a7694023
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Thu Jul 22 15:46:46 2021 +0300
ve/memcg: Fix /proc/vmstat virtualization (drop extra recursion)
Fixes: 5f48326db336 ("ve/memcg: Virtualize /proc/vmstat view inside CT")
https://jira.sw.ru/browse/PSBM-131992
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
mm/memcontrol.c | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b518bae93b29..29c7b062e9c2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3897,7 +3897,7 @@ void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg, struct meminfo *mi)
void mem_cgroup_fill_vmstat(struct mem_cgroup *memcg, unsigned long *stats)
{
- int cpu, i;
+ int i;
unsigned long limit = READ_ONCE(memcg->memory.max);
unsigned long memory = page_counter_read(&memcg->memory);
unsigned long *zone_stats = stats;
@@ -3923,28 +3923,18 @@ void mem_cgroup_fill_vmstat(struct mem_cgroup *memcg, unsigned long *stats)
node_stats[NR_FILE_PAGES] = node_stats[NR_ACTIVE_FILE] +
node_stats[NR_INACTIVE_FILE];
- node_stats[NR_SLAB_RECLAIMABLE] = mem_page_state_recursive(
- memcg, NR_SLAB_RECLAIMABLE);
- node_stats[NR_SLAB_UNRECLAIMABLE] = mem_page_state_recursive(
- memcg, NR_SLAB_UNRECLAIMABLE);
- node_stats[NR_FILE_MAPPED] = mem_page_state_recursive(
- memcg, NR_FILE_MAPPED);
- node_stats[NR_SHMEM] = mem_page_state_recursive(
- memcg, NR_SHMEM);
-
-
+ node_stats[NR_SLAB_RECLAIMABLE] =
+ memcg_page_state(memcg, NR_SLAB_RECLAIMABLE);
+ node_stats[NR_SLAB_UNRECLAIMABLE] =
+ memcg_page_state(memcg, NR_SLAB_UNRECLAIMABLE);
+ node_stats[NR_FILE_MAPPED] = memcg_page_state(memcg, NR_FILE_MAPPED);
+ node_stats[NR_SHMEM] = memcg_page_state(memcg, NR_SHMEM);
#ifdef CONFIG_VM_EVENT_COUNTERS
- for_each_possible_cpu(cpu) {
- vm_stats[PSWPIN] += per_cpu(
- memcg->vmstats_local->events[PSWPIN], cpu);
- vm_stats[PSWPOUT] += per_cpu(
- memcg->vmstats_local->events[PSWPOUT], cpu);
- vm_stats[PGFAULT] += per_cpu(
- memcg->vmstats_local->events[PGFAULT], cpu);
- vm_stats[PGMAJFAULT] += per_cpu(
- memcg->vmstats_local->events[PGMAJFAULT], cpu);
- }
+ vm_stats[PSWPIN] = memcg_events(memcg, PSWPIN);
+ vm_stats[PSWPOUT] = memcg_events(memcg, PSWPOUT);
+ vm_stats[PGFAULT] = memcg_events(memcg, PGFAULT);
+ vm_stats[PGMAJFAULT] = memcg_events(memcg, PGMAJFAULT);
#endif
}
More information about the Devel
mailing list