mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 15:33:28 +00:00
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/[email protected] Signed-off-by: Mel Gorman <[email protected]> Acked-by: Hillf Danton <[email protected]> Acked-by: Johannes Weiner <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
7cc30fcfd2
commit
e2ecc8a79e
+24
@@ -1415,11 +1415,35 @@ static const struct file_operations pagetypeinfo_file_ops = {
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
static bool is_zone_first_populated(pg_data_t *pgdat, struct zone *zone)
|
||||
{
|
||||
int zid;
|
||||
|
||||
for (zid = 0; zid < MAX_NR_ZONES; zid++) {
|
||||
struct zone *compare = &pgdat->node_zones[zid];
|
||||
|
||||
if (populated_zone(compare))
|
||||
return zone == compare;
|
||||
}
|
||||
|
||||
/* The zone must be somewhere! */
|
||||
WARN_ON_ONCE(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
|
||||
struct zone *zone)
|
||||
{
|
||||
int i;
|
||||
seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name);
|
||||
if (is_zone_first_populated(pgdat, zone)) {
|
||||
seq_printf(m, "\n per-node stats");
|
||||
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));
|
||||
}
|
||||
}
|
||||
seq_printf(m,
|
||||
"\n pages free %lu"
|
||||
"\n min %lu"
|
||||
|
||||
Reference in New Issue
Block a user