[Devel] [PATCH vz8.2 4/4] ve/memcg: Fix /proc/vmstat virtualization (drop extra recursion)
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Jul 22 16:53:22 MSK 2021
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
}
--
2.28.0
More information about the Devel
mailing list