Commit edfbe2b0038723e5699ab22695ccd62b5542a5c1

Authored by KAMEZAWA Hiroyuki
Committed by Linus Torvalds
1 parent 2054606ad6

[PATCH] count bounce buffer pages in vmstat

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>

Showing 3 changed files with 4 additions and 0 deletions Side-by-side Diff

include/linux/page-flags.h
... ... @@ -131,6 +131,7 @@
131 131 unsigned long allocstall; /* direct reclaim calls */
132 132  
133 133 unsigned long pgrotated; /* pages rotated to tail of the LRU */
  134 + unsigned long nr_bounce; /* pages for bounce buffers */
134 135 };
135 136  
136 137 extern void get_page_state(struct page_state *ret);
... ... @@ -325,6 +325,7 @@
325 325 continue;
326 326  
327 327 mempool_free(bvec->bv_page, pool);
  328 + dec_page_state(nr_bounce);
328 329 }
329 330  
330 331 bio_endio(bio_orig, bio_orig->bi_size, err);
... ... @@ -405,6 +406,7 @@
405 406 to->bv_page = mempool_alloc(pool, q->bounce_gfp);
406 407 to->bv_len = from->bv_len;
407 408 to->bv_offset = from->bv_offset;
  409 + inc_page_state(nr_bounce);
408 410  
409 411 if (rw == WRITE) {
410 412 char *vto, *vfrom;
... ... @@ -1897,6 +1897,7 @@
1897 1897 "allocstall",
1898 1898  
1899 1899 "pgrotated",
  1900 + "nr_bounce",
1900 1901 };
1901 1902  
1902 1903 static void *vmstat_start(struct seq_file *m, loff_t *pos)