diff options
author | Akinobu Mita <amgta@yacht.ocn.ne.jp> | 2004-08-23 21:45:14 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-23 21:45:14 -0700 |
commit | d9660d8277eda0ea18412bb306225261d1c8dd92 (patch) | |
tree | de67d617033add034ad0c56fb8638abd37f520ff /mm | |
parent | c9d12e45058956c4356c894d6518709315f056ba (diff) | |
download | history-d9660d8277eda0ea18412bb306225261d1c8dd92.tar.gz |
[PATCH] show Active/Inactive on per-node meminfo
The patch below enable to display the size of Active/Inactive pages on
per-node meminfo (/sys/devices/system/node/node%d/meminfo) like
/proc/meminfo.
By a little change to procps, "vmstat -a" can show these statistics about
particular node.
From: mita akinobu <amgta@yacht.ocn.ne.jp>
get_zone_counts() is used by max_sane_readahead(), and
max_sane_readahead() is often called in filemap_nopage().
Signed-off-by: Akinobu Mita <amgta@yacht.ocn.ne.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_alloc.c | 28 | ||||
-rw-r--r-- | mm/readahead.c | 2 |
2 files changed, 24 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 050f5a41c37dc1..d156d5dab9d993 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -961,18 +961,36 @@ unsigned long __read_page_state(unsigned offset) return ret; } +void __get_zone_counts(unsigned long *active, unsigned long *inactive, + unsigned long *free, struct pglist_data *pgdat) +{ + struct zone *zones = pgdat->node_zones; + int i; + + *active = 0; + *inactive = 0; + *free = 0; + for (i = 0; i < MAX_NR_ZONES; i++) { + *active += zones[i].nr_active; + *inactive += zones[i].nr_inactive; + *free += zones[i].free_pages; + } +} + void get_zone_counts(unsigned long *active, unsigned long *inactive, unsigned long *free) { - struct zone *zone; + struct pglist_data *pgdat; *active = 0; *inactive = 0; *free = 0; - for_each_zone(zone) { - *active += zone->nr_active; - *inactive += zone->nr_inactive; - *free += zone->free_pages; + for_each_pgdat(pgdat) { + unsigned long l, m, n; + __get_zone_counts(&l, &m, &n, pgdat); + *active += l; + *inactive += m; + *free += n; } } diff --git a/mm/readahead.c b/mm/readahead.c index c58ae5694421f3..a5e6906a01e030 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -571,6 +571,6 @@ unsigned long max_sane_readahead(unsigned long nr) unsigned long inactive; unsigned long free; - get_zone_counts(&active, &inactive, &free); + __get_zone_counts(&active, &inactive, &free, NODE_DATA(numa_node_id())); return min(nr, (inactive + free) / 2); } |