From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Subject: [RFC][PATCH] counting bounce pages.
Date: Mon, 25 Apr 2005 19:33:11 +0900 [thread overview]
Message-ID: <426CC767.8050507@jp.fujitsu.com> (raw)
[-- 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),
_
next reply other threads:[~2005-04-25 10:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-25 10:33 KAMEZAWA Hiroyuki [this message]
2005-04-25 10:53 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=426CC767.8050507@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®