提交 edfbe2b0 编写于 作者: K KAMEZAWA Hiroyuki 提交者: Linus Torvalds

[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: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 2054606a
...@@ -131,6 +131,7 @@ struct page_state { ...@@ -131,6 +131,7 @@ struct page_state {
unsigned long allocstall; /* direct reclaim calls */ unsigned long allocstall; /* direct reclaim calls */
unsigned long pgrotated; /* pages rotated to tail of the LRU */ 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); extern void get_page_state(struct page_state *ret);
......
...@@ -325,6 +325,7 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool, int err) ...@@ -325,6 +325,7 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool, int err)
continue; continue;
mempool_free(bvec->bv_page, pool); mempool_free(bvec->bv_page, pool);
dec_page_state(nr_bounce);
} }
bio_endio(bio_orig, bio_orig->bi_size, err); 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, ...@@ -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_page = mempool_alloc(pool, q->bounce_gfp);
to->bv_len = from->bv_len; to->bv_len = from->bv_len;
to->bv_offset = from->bv_offset; to->bv_offset = from->bv_offset;
inc_page_state(nr_bounce);
if (rw == WRITE) { if (rw == WRITE) {
char *vto, *vfrom; char *vto, *vfrom;
......
...@@ -1897,6 +1897,7 @@ static char *vmstat_text[] = { ...@@ -1897,6 +1897,7 @@ static char *vmstat_text[] = {
"allocstall", "allocstall",
"pgrotated", "pgrotated",
"nr_bounce",
}; };
static void *vmstat_start(struct seq_file *m, loff_t *pos) static void *vmstat_start(struct seq_file *m, loff_t *pos)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册