From: Christoph Lameter Conversion of nr_bounce to a per zone counter nr_bounce is only used for proc output. So it could be left as an eventcounter. However, the eventcounters are not accurate and nr_bounce is categorizing one type of page in a zone. So we really need this to also be a per zone counter. Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton --- drivers/base/node.c | 6 ++++-- include/linux/mmzone.h | 1 + include/linux/page-flags.h | 1 - mm/highmem.c | 4 ++-- mm/page_alloc.c | 6 +++--- 5 files changed, 10 insertions(+), 8 deletions(-) diff -puN drivers/base/node.c~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter drivers/base/node.c --- devel/drivers/base/node.c~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter 2006-06-09 15:21:53.000000000 -0700 +++ devel-akpm/drivers/base/node.c 2006-06-09 15:21:53.000000000 -0700 @@ -67,7 +67,8 @@ static ssize_t node_read_meminfo(struct "Node %d Unstable: %8lu kB\n" "Node %d Mapped: %8lu kB\n" "Node %d Pagecache: %8lu kB\n" - "Node %d Slab: %8lu kB\n", + "Node %d Slab: %8lu kB\n" + "Node %d Bounce: %8lu kB\n", nid, K(i.totalram), nid, K(i.freeram), nid, K(i.totalram - i.freeram), @@ -82,7 +83,8 @@ static ssize_t node_read_meminfo(struct nid, K(nr[NR_UNSTABLE]), nid, K(nr[NR_MAPPED]), nid, K(nr[NR_PAGECACHE]), - nid, K(nr[NR_SLAB])); + nid, K(nr[NR_SLAB]), + nid, K(nr[NR_BOUNCE])); n += hugetlb_report_node_meminfo(nid, buf + n); return n; } diff -puN include/linux/mmzone.h~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter include/linux/mmzone.h --- devel/include/linux/mmzone.h~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter 2006-06-09 15:21:53.000000000 -0700 +++ devel-akpm/include/linux/mmzone.h 2006-06-09 15:21:53.000000000 -0700 @@ -55,6 +55,7 @@ enum zone_stat_item { NR_DIRTY, NR_WRITEBACK, NR_UNSTABLE, /* NFS unstable pages */ + NR_BOUNCE, NR_STAT_ITEMS }; struct per_cpu_pages { diff -puN include/linux/page-flags.h~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter include/linux/page-flags.h --- devel/include/linux/page-flags.h~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter 2006-06-09 15:21:53.000000000 -0700 +++ devel-akpm/include/linux/page-flags.h 2006-06-09 15:21:53.000000000 -0700 @@ -166,7 +166,6 @@ struct page_state { unsigned long allocstall; /* direct reclaim calls */ unsigned long pgrotated; /* pages rotated to tail of the LRU */ - unsigned long nr_bounce; /* pages for bounce buffers */ }; extern void get_full_page_state(struct page_state *ret); diff -puN mm/highmem.c~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter mm/highmem.c --- devel/mm/highmem.c~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter 2006-06-09 15:21:53.000000000 -0700 +++ devel-akpm/mm/highmem.c 2006-06-09 15:21:53.000000000 -0700 @@ -316,7 +316,7 @@ static void bounce_end_io(struct bio *bi continue; mempool_free(bvec->bv_page, pool); - dec_page_state(nr_bounce); + dec_zone_page_state(bvec->bv_page, NR_BOUNCE); } bio_endio(bio_orig, bio_orig->bi_size, err); @@ -397,7 +397,7 @@ static void __blk_queue_bounce(request_q to->bv_page = mempool_alloc(pool, q->bounce_gfp); to->bv_len = from->bv_len; to->bv_offset = from->bv_offset; - inc_page_state(nr_bounce); + inc_zone_page_state(to->bv_page, NR_BOUNCE); if (rw == WRITE) { char *vto, *vfrom; diff -puN mm/page_alloc.c~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter mm/page_alloc.c --- devel/mm/page_alloc.c~zoned-vm-counters-conversion-of-nr_bounce-to-per-zone-counter 2006-06-09 15:21:53.000000000 -0700 +++ devel-akpm/mm/page_alloc.c 2006-06-09 15:21:53.000000000 -0700 @@ -615,7 +615,7 @@ static int rmqueue_bulk(struct zone *zon char *vm_stat_item_descr[NR_STAT_ITEMS] = { "mapped", "pagecache", "slab", "pagetable", "dirty", "writeback", - "unstable" + "unstable", "bounce" }; /* @@ -2696,6 +2696,7 @@ static char *vmstat_text[] = { "nr_dirty", "nr_writeback", "nr_unstable", + "nr_bounce", /* Page state */ "pgpgin", @@ -2742,8 +2743,7 @@ static char *vmstat_text[] = { "pageoutrun", "allocstall", - "pgrotated", - "nr_bounce", + "pgrotated" }; static void *vmstat_start(struct seq_file *m, loff_t *pos) _