counting bounce buffer in vmstat
Subsystems (3)
PATCH 1/1 counting bounce buffer in vmstat
Hi,
This is a updated version of a patch for counting bouce buffer page. A major change is :/proc/vmstat is used to show usage.
Thanks
-- Kame
This is a patch for counting the number of pages for bounce buffer. 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.
---
linux-2.6.12-rc2-mm3-kamezawa/include/linux/page-flags.h | 1 + linux-2.6.12-rc2-mm3-kamezawa/mm/highmem.c | 2 ++ linux-2.6.12-rc2-mm3-kamezawa/mm/page_alloc.c | 1 + 3 files changed, 4 insertions(+)
mm/highmem.c renamed from mm/highmem.c~count_bounce +2 -0
@@ -325,6 +325,7 @@ static void bounce_end_io(struct bio *bicontinue ;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_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);if (rw ==WRITE ) {char *vto, *vfrom;
mm/page_alloc.c renamed from mm/page_alloc.c~count_bounce +1 -0
@@ -1902,6 +1902,7 @@ static char *vmstat_text[] = {"nr_page_table_pages" ,"nr_mapped" ,"nr_slab" , +"nr_bounce" ,"pgpgin" , "pgpgout",
include/linux/page-flags.h renamed from include/linux/page-flags.h~count_bounce +1 -0
@@ -89,6 +89,7 @@ struct page_state {unsigned long nr_page_table_pages;/* Pages used for pagetables */ unsigned long nr_mapped;/* mapped into pagetables */ unsigned long nr_slab;/* In slab */ +unsigned long nr_bounce;/* pages for bounce buffers */ #define GET_PAGE_STATE_LAST nr_slab/*
_
Quoted 10 lines · KAMEZAWA Hiroyuki
diff -puN
include/linux/page-flags.h~count_bounceinclude/linux/page-flags.h
--- linux-2.6.12-rc2-mm3/include/linux/page-flags.h~count_bounce 2005-04-27 10:23:15.000000000 +0900
+++linux-2.6.12-rc2-mm3-kamezawa/include/linux/page-flags.h2005-04-27 10:24:11.000000000 +0900
@@ -89,6 +89,7 @@ structpage_state{
unsigned long nr_page_table_pages;/* Pages used for pagetables */
unsigned longnr_mapped; /* mapped into pagetables */
unsigned longnr_slab; /* In slab */
+ unsigned longnr_bounce; /* pages for bounce buffers */
#defineGET_PAGE_STATE_LASTnr_slab
That's not really right.
There are two functions: get_page_state() and get_full_page_state(). get_page_state() only gets those fields up to and including GET_PAGE_STATE_LAST. The way you have the code laid out there implies that get_page_state() also calculates the total nr_bounce, only it doesn't.
I'll fix it up.
Quoted 9 lines · Andrew Morton
That's not really right.
There are two functions:
get_page_state()andget_full_page_state().get_page_state()only gets those fields up to and includingGET_PAGE_STATE_LAST. The way you have the code laid out there implies thatget_page_state()also calculates the totalnr_bounce, only it doesn't.I'll fix it up.
Oh, I misunderstood that.
Thank you.
-- Kame
In article <[email protected]> (at Wed, 27 Apr 2005 15:42:13 +0900), KAMEZAWA Hiroyuki <[email protected]> says:
include/linux/page-flags.h struct page_state { · line 95
Quoted 11 lines
diff -puN
include/linux/page-flags.h~count_bounceinclude/linux/page-flags.hinclude/linux/page-flags.h renamed from include/linux/page-flags.h~count_bounce +1
-0@@ -89,6 +89,7 @@ struct page_state {unsigned long nr_page_table_pages;/* Pages used for pagetables */ unsigned long nr_mapped;/* mapped into pagetables */ unsigned long nr_slab;/* In slab */ +unsigned long nr_bounce;/* pages for bounce buffers */ #define GET_PAGE_STATE_LAST nr_slab/*
I think you need to change GET_PAGE_STATE_LAST as well.
--yoshfuji