* [RFC][PATCH] counting bounce pages.
@ 2005-04-25 10:33 KAMEZAWA Hiroyuki
2005-04-25 10:53 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2005-04-25 10:33 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
Hi
This is a patch for counting bounce pages.
With this, pages for bounce buffer is coutned and shown in /proc/meminfo.
Because pages for bounce buffer are not counted in anywhere,
sometimes it seems that there are many leaked pages.
ex)
I found 1.7GB of bounce buffer pages in a crash dump of ia64 kernel,
which was passed me to check memory usage. :(
BTW, I'm not sure whether # of bounce buffer should be includeded in Buffers:
of /proc/meminfo.
-- Kame <kamezawa.hiroyu@jp.fujitsu.com>
[-- Attachment #2: count_bounce.patch --]
[-- Type: text/plain, Size: 2599 bytes --]
count the number of bounce pages.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
linux-2.6.12-rc2-mm3-kamezawa/fs/proc/proc_misc.c | 7 +++++--
linux-2.6.12-rc2-mm3-kamezawa/mm/highmem.c | 3 +++
2 files changed, 8 insertions(+), 2 deletions(-)
diff -puN mm/highmem.c~count_bounce mm/highmem.c
--- linux-2.6.12-rc2-mm3/mm/highmem.c~count_bounce 2005-04-25 12:04:28.000000000 +0900
+++ linux-2.6.12-rc2-mm3-kamezawa/mm/highmem.c 2005-04-25 16:10:52.000000000 +0900
@@ -214,6 +214,7 @@ void fastcall kunmap_high(struct page *p
EXPORT_SYMBOL(kunmap_high);
#define POOL_SIZE 64
+atomic_t nr_bounce_pages = ATOMIC_INIT(0);
static __init int init_emergency_pool(void)
{
@@ -325,6 +326,7 @@ static void bounce_end_io(struct bio *bi
continue;
mempool_free(bvec->bv_page, pool);
+ atomic_dec(&nr_bounce_pages);
}
bio_endio(bio_orig, bio_orig->bi_size, err);
@@ -405,6 +407,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;
+ atomic_inc(&nr_bounce_pages);
if (rw == WRITE) {
char *vto, *vfrom;
diff -puN fs/proc/proc_misc.c~count_bounce fs/proc/proc_misc.c
--- linux-2.6.12-rc2-mm3/fs/proc/proc_misc.c~count_bounce 2005-04-25 12:08:28.000000000 +0900
+++ linux-2.6.12-rc2-mm3-kamezawa/fs/proc/proc_misc.c 2005-04-25 16:06:39.000000000 +0900
@@ -114,7 +114,7 @@ static int uptime_read_proc(char *page,
return proc_calc_metrics(page, start, off, count, eof, len);
}
-
+extern atomic_t nr_bounce_pages;
static int meminfo_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
@@ -128,6 +128,7 @@ static int meminfo_read_proc(char *page,
unsigned long allowed;
struct vmalloc_info vmi;
long cached;
+ unsigned long bounce;
get_page_state(&ps);
get_zone_counts(&active, &inactive, &free);
@@ -147,7 +148,7 @@ static int meminfo_read_proc(char *page,
cached = 0;
get_vmalloc_info(&vmi);
-
+ bounce = atomic_read(&nr_bounce_pages);
/*
* Tagged format, for easy grepping and expansion.
*/
@@ -169,6 +170,7 @@ static int meminfo_read_proc(char *page,
"Writeback: %8lu kB\n"
"Mapped: %8lu kB\n"
"Slab: %8lu kB\n"
+ "Bounce : %8lu kB\n"
"CommitLimit: %8lu kB\n"
"Committed_AS: %8lu kB\n"
"PageTables: %8lu kB\n"
@@ -192,6 +194,7 @@ static int meminfo_read_proc(char *page,
K(ps.nr_writeback),
K(ps.nr_mapped),
K(ps.nr_slab),
+ K(bounce),
K(allowed),
K(committed),
K(ps.nr_page_table_pages),
_
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC][PATCH] counting bounce pages.
2005-04-25 10:33 [RFC][PATCH] counting bounce pages KAMEZAWA Hiroyuki
@ 2005-04-25 10:53 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2005-04-25 10:53 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki; +Cc: linux-kernel
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> This is a patch for counting bounce pages.
> With this, pages for bounce buffer is coutned and shown in /proc/meminfo.
As it's purely a debug thing, perhaps /proc/vmstat would be a better place
for displaying this info.
> Because pages for bounce buffer are not counted in anywhere,
> sometimes it seems that there are many leaked pages.
> ex)
> I found 1.7GB of bounce buffer pages in a crash dump of ia64 kernel,
> which was passed me to check memory usage. :(
whoops.
> BTW, I'm not sure whether # of bounce buffer should be includeded in Buffers:
> of /proc/meminfo.
No, "Buffers:" is "the number of bytes allocated to blockdevice pagecache".
Usually this is filesystem metadata.
> --- linux-2.6.12-rc2-mm3/fs/proc/proc_misc.c~count_bounce 2005-04-25 12:08:28.000000000 +0900
> +++ linux-2.6.12-rc2-mm3-kamezawa/fs/proc/proc_misc.c 2005-04-25 16:06:39.000000000 +0900
> @@ -114,7 +114,7 @@ static int uptime_read_proc(char *page,
>
> return proc_calc_metrics(page, start, off, count, eof, len);
> }
> -
> +extern atomic_t nr_bounce_pages;
Please always put extern declarations into .h files, with the declaration
visible to the definition and to all users.
> + "Bounce : %8lu kB\n"
There's an unneeded space in there.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-25 10:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-25 10:33 [RFC][PATCH] counting bounce pages KAMEZAWA Hiroyuki
2005-04-25 10:53 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.