[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1513665566-4465-5-git-send-email-kemi.wang@intel.com>
Date: Tue, 19 Dec 2017 14:39:25 +0800
From: Kemi Wang <kemi.wang@...el.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>,
Vlastimil Babka <vbabka@...e.cz>,
Mel Gorman <mgorman@...hsingularity.net>,
Johannes Weiner <hannes@...xchg.org>,
Christopher Lameter <cl@...ux.com>,
YASUAKI ISHIMATSU <yasu.isimatu@...il.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Nikolay Borisov <nborisov@...e.com>,
Pavel Tatashin <pasha.tatashin@...cle.com>,
David Rientjes <rientjes@...gle.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Dave <dave.hansen@...ux.intel.com>,
Andi Kleen <andi.kleen@...el.com>,
Tim Chen <tim.c.chen@...el.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Ying Huang <ying.huang@...el.com>,
Aaron Lu <aaron.lu@...el.com>, Aubrey Li <aubrey.li@...el.com>,
Kemi Wang <kemi.wang@...el.com>, Linux MM <linux-mm@...ck.org>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 4/5] mm: use node_page_state_snapshot to avoid deviation
To avoid deviation, this patch uses node_page_state_snapshot instead of
node_page_state for node page stats query.
e.g. cat /proc/zoneinfo
cat /sys/devices/system/node/node*/vmstat
cat /sys/devices/system/node/node*/numastat
As it is a slow path and would not be read frequently, I would worry about
it.
Signed-off-by: Kemi Wang <kemi.wang@...el.com>
---
drivers/base/node.c | 17 ++++++++++-------
mm/vmstat.c | 2 +-
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/base/node.c b/drivers/base/node.c
index a045ea1..cf303f8 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -169,12 +169,15 @@ static ssize_t node_read_numastat(struct device *dev,
"interleave_hit %lu\n"
"local_node %lu\n"
"other_node %lu\n",
- node_page_state(NODE_DATA(dev->id), NUMA_HIT),
- node_page_state(NODE_DATA(dev->id), NUMA_MISS),
- node_page_state(NODE_DATA(dev->id), NUMA_FOREIGN),
- node_page_state(NODE_DATA(dev->id), NUMA_INTERLEAVE_HIT),
- node_page_state(NODE_DATA(dev->id), NUMA_LOCAL),
- node_page_state(NODE_DATA(dev->id), NUMA_OTHER));
+ node_page_state_snapshot(NODE_DATA(dev->id), NUMA_HIT),
+ node_page_state_snapshot(NODE_DATA(dev->id), NUMA_MISS),
+ node_page_state_snapshot(NODE_DATA(dev->id),
+ NUMA_FOREIGN),
+ node_page_state_snapshot(NODE_DATA(dev->id),
+ NUMA_INTERLEAVE_HIT),
+ node_page_state_snapshot(NODE_DATA(dev->id), NUMA_LOCAL),
+ node_page_state_snapshot(NODE_DATA(dev->id),
+ NUMA_OTHER));
}
static DEVICE_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
@@ -194,7 +197,7 @@ static ssize_t node_read_vmstat(struct device *dev,
for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++)
n += sprintf(buf+n, "%s %lu\n",
vmstat_text[i + NR_VM_ZONE_STAT_ITEMS],
- node_page_state(pgdat, i));
+ node_page_state_snapshot(pgdat, i));
return n;
}
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 64e08ae..d65f28d 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1466,7 +1466,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) {
seq_printf(m, "\n %-12s %lu",
vmstat_text[i + NR_VM_ZONE_STAT_ITEMS],
- node_page_state(pgdat, i));
+ node_page_state_snapshot(pgdat, i));
}
}
seq_printf(m,
--
2.7.4
Powered by blists - more mailing lists