[Devel] [PATCH vz9] vzstat: Fix incorrect [in]active anon/file memory statistics

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 4 14:54:51 MSK 2025


Use contants from correct enums:
   NR_{ACTIVE,INACTIVE}_{ANON,FILE} -> NR_ZONE_{ACTIVE,INACTIVE}_{ANON,FILE}

New enum has been introduced by the commit:
   ms commit 599d0c954f91 ("mm, vmscan: move LRU lists to node")

So before the patch vzstat messed types of memory to report.

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

Feature: ve: extra statistics (mm, latency)
---
 kernel/ve/vzstat.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/ve/vzstat.c b/kernel/ve/vzstat.c
index 73063a4189d72..5b83370c7f64d 100644
--- a/kernel/ve/vzstat.c
+++ b/kernel/ve/vzstat.c
@@ -253,10 +253,10 @@ static void update_memory(void)
 
 			present++;
 			nr_free += zone_page_state(zone, NR_FREE_PAGES);
-			nr_active +=  zone_page_state(zone, NR_ACTIVE_ANON) +
-				zone_page_state(zone, NR_ACTIVE_FILE);
-			nr_inactive += zone_page_state(zone, NR_INACTIVE_ANON) +
-				zone_page_state(zone, NR_INACTIVE_FILE);
+			nr_active +=  zone_page_state(zone, NR_ZONE_ACTIVE_ANON) +
+				zone_page_state(zone, NR_ZONE_ACTIVE_FILE);
+			nr_inactive += zone_page_state(zone, NR_ZONE_INACTIVE_ANON) +
+				zone_page_state(zone, NR_ZONE_INACTIVE_FILE);
 		}
 
 		if (!present)
@@ -471,10 +471,10 @@ static void mem_free_areas_show(struct seq_file *m, void *v)
 				zdst->nr_free[order] += zsrc->free_area[order].nr_free;
 			spin_unlock_irqrestore(&zsrc->lock, flags);
 
-			zdst->nr_active     += zone_page_state(zsrc, NR_ACTIVE_ANON) +
-						zone_page_state(zsrc, NR_ACTIVE_FILE);
-			zdst->nr_inactive   += zone_page_state(zsrc, NR_INACTIVE_ANON) +
-						zone_page_state(zsrc, NR_INACTIVE_FILE);
+			zdst->nr_active     += zone_page_state(zsrc, NR_ZONE_ACTIVE_ANON) +
+						zone_page_state(zsrc, NR_ZONE_ACTIVE_FILE);
+			zdst->nr_inactive   += zone_page_state(zsrc, NR_ZONE_INACTIVE_ANON) +
+						zone_page_state(zsrc, NR_ZONE_INACTIVE_FILE);
 			zdst->pages_min     += min_wmark_pages(zsrc);
 			zdst->pages_low     += low_wmark_pages(zsrc);
 			zdst->pages_high    += high_wmark_pages(zsrc);
-- 
2.43.0



More information about the Devel mailing list