diff options
author | Mel Gorman <mgorman@techsingularity.net> | 2016-07-28 18:47:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-28 19:07:41 -0400 |
commit | e2ecc8a79ed49f7838b4fdf352c4c48cec9424ac (patch) | |
tree | c0b66ce74a17ab6ddfc2b6f9344113ea0d04e10e | |
parent | 7cc30fcfd2a894589d832a192cac3dc5cd302bb8 (diff) |
mm, vmstat: print node-based stats in zoneinfo file
There are a number of stats that were previously accessible via zoneinfo
that are now invisible. While it is possible to create a new file for
the node stats, this may be missed by users. Instead this patch prints
the stats under the first populated zone in /proc/zoneinfo.
Link: http://lkml.kernel.org/r/1467970510-21195-34-git-send-email-mgorman@techsingularity.net
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rik van Riel <riel@surriel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/vmstat.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c index 5caaf3f7b8ab..ac509572a50b 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -1415,11 +1415,35 @@ static const struct file_operations pagetypeinfo_file_ops = { | |||
1415 | .release = seq_release, | 1415 | .release = seq_release, |
1416 | }; | 1416 | }; |
1417 | 1417 | ||
1418 | static bool is_zone_first_populated(pg_data_t *pgdat, struct zone *zone) | ||
1419 | { | ||
1420 | int zid; | ||
1421 | |||
1422 | for (zid = 0; zid < MAX_NR_ZONES; zid++) { | ||
1423 | struct zone *compare = &pgdat->node_zones[zid]; | ||
1424 | |||
1425 | if (populated_zone(compare)) | ||
1426 | return zone == compare; | ||
1427 | } | ||
1428 | |||
1429 | /* The zone must be somewhere! */ | ||
1430 | WARN_ON_ONCE(1); | ||
1431 | return false; | ||
1432 | } | ||
1433 | |||
1418 | static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, | 1434 | static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, |
1419 | struct zone *zone) | 1435 | struct zone *zone) |
1420 | { | 1436 | { |
1421 | int i; | 1437 | int i; |
1422 | seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name); | 1438 | seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name); |
1439 | if (is_zone_first_populated(pgdat, zone)) { | ||
1440 | seq_printf(m, "\n per-node stats"); | ||
1441 | for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) { | ||
1442 | seq_printf(m, "\n %-12s %lu", | ||
1443 | vmstat_text[i + NR_VM_ZONE_STAT_ITEMS], | ||
1444 | node_page_state(pgdat, i)); | ||
1445 | } | ||
1446 | } | ||
1423 | seq_printf(m, | 1447 | seq_printf(m, |
1424 | "\n pages free %lu" | 1448 | "\n pages free %lu" |
1425 | "\n min %lu" | 1449 | "\n min %lu" |