[Devel] [PATCH rh7 1/2] mm/vmstat, io_acct: fix PGPGIN/PGPGOUT in container's /proc/vmstat.

Andrey Ryabinin aryabinin at virtuozzo.com
Wed Sep 26 13:46:51 MSK 2018


In container the pgpgin/pgpgout in /proc/vmstat were incorrectly printed
in nr_dirty_threshold, and nr_dirty_background_threshold fields, because
offset of the vm_events events array calculated incorrectly. We didn't
take into account array of writeback_stat_item which comes before the
vm_events. Fix up the offset.

https://jira.sw.ru/browse/PSBM-88323
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 include/linux/vmstat.h | 7 +++++++
 kernel/bc/io_acct.c    | 3 ++-
 mm/vmstat.c            | 6 ------
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 99c3389fb3ec..f0a517753c9d 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -10,6 +10,13 @@
 
 extern int sysctl_stat_interval;
 
+enum writeback_stat_item {
+	NR_DIRTY_THRESHOLD,
+	NR_DIRTY_BG_THRESHOLD,
+	NR_VM_WRITEBACK_STAT_ITEMS,
+};
+
+
 #ifdef CONFIG_VM_EVENT_COUNTERS
 /*
  * Light weight per cpu counter implementation.
diff --git a/kernel/bc/io_acct.c b/kernel/bc/io_acct.c
index 22122242356f..9ccfd15e6e26 100644
--- a/kernel/bc/io_acct.c
+++ b/kernel/bc/io_acct.c
@@ -313,7 +313,8 @@ static int bc_ioacct_notify(struct vnotifier_block *self,
 	bout >>= 10;
 	bin >>= 10;
 
-	vm_events = ((unsigned long *)arg) + NR_VM_ZONE_STAT_ITEMS;
+	vm_events = ((unsigned long *)arg) + NR_VM_ZONE_STAT_ITEMS +
+		NR_VM_WRITEBACK_STAT_ITEMS;
 	vm_events[PGPGOUT] = (unsigned long)bout;
 	vm_events[PGPGIN] = (unsigned long)bin;
 	return NOTIFY_OK;
diff --git a/mm/vmstat.c b/mm/vmstat.c
index ed6a5945a684..9e8e5eab0636 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1157,12 +1157,6 @@ static const struct file_operations proc_zoneinfo_file_operations = {
 	.release	= seq_release,
 };
 
-enum writeback_stat_item {
-	NR_DIRTY_THRESHOLD,
-	NR_DIRTY_BG_THRESHOLD,
-	NR_VM_WRITEBACK_STAT_ITEMS,
-};
-
 static void *vmstat_start(struct seq_file *m, loff_t *pos)
 {
 	unsigned long *v;
-- 
2.16.4



More information about the Devel mailing list