[PATCH] count bounce buffer pages in vmstat
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Sun, 1 May 2005 15:58:37 +0000 (08:58 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 1 May 2005 15:58:37 +0000 (08:58 -0700)
This is a patch for counting the number of pages for bounce buffers.  It's
shown in /proc/vmstat.

Currently, the number of bounce pages are not counted anywhere.  So, if
there are many bounce pages, it seems that there are leaked pages.  And
it's difficult for a user to imagine the usage of bounce pages.  So, it's
meaningful to show # of bouce pages.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/page-flags.h
mm/highmem.c
mm/page_alloc.c

index 6b74fcf5bb638cb29fe5da4c8009db9fa2759508..39ab8c6b5652edefe8a85559692dac1395c7b8fe 100644 (file)
@@ -131,6 +131,7 @@ 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_page_state(struct page_state *ret);
index d01276506b004755171f5f545a161cbcae6e12c4..4009115994683b6fe733d56a72589088c7ab6319 100644 (file)
@@ -325,6 +325,7 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool, int err)
                        continue;
 
                mempool_free(bvec->bv_page, pool);      
+               dec_page_state(nr_bounce);
        }
 
        bio_endio(bio_orig, bio_orig->bi_size, err);
@@ -405,6 +406,7 @@ static void __blk_queue_bounce(request_queue_t *q, struct bio **bio_orig,
                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);
 
                if (rw == WRITE) {
                        char *vto, *vfrom;
index 04a35b3d32620cfc53f7b2a93b5a866d846aac0d..80ce7f2104dfa915f7563c2ae1800dd71f5b4edc 100644 (file)
@@ -1897,6 +1897,7 @@ static char *vmstat_text[] = {
        "allocstall",
 
        "pgrotated",
+       "nr_bounce",
 };
 
 static void *vmstat_start(struct seq_file *m, loff_t *pos)