From: Dave Hansen <haveblue@us.ibm.com>
To: Andrew Morton <akpm@zip.com.au>
Cc: "Martin J. Bligh" <Martin.Bligh@us.ibm.com>, linux-mm@kvack.org
Subject: [PATCH] add vmalloc instrumentation
Date: Mon, 26 Aug 2002 08:56:47 -0700 [thread overview]
Message-ID: <3D6A4FBF.806F2D89@us.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
I run out of vmalloc space fairly often. This patch helps me to figure
out whether I'm seeing vmalloc space fragmentation, or I've actually out
of vmalloc area. It adds 3 fields to /proc/meminfo: total vmalloc
space, used vmalloc space, and the largest remaining chunk of free
vmalloc space.
--
Dave Hansen
haveblue@us.ibm.com
[-- Attachment #2: vmalloc-stats-2.5.31+bk-1.patch --]
[-- Type: text/plain, Size: 2478 bytes --]
--- linux-2.5/fs/proc/proc_misc.c Tue Aug 13 15:40:44 2002
+++ linux-2.5-vmalloc-stats-work/fs/proc/proc_misc.c Mon Aug 26 08:43:17 2002
@@ -37,6 +37,7 @@
#include <linux/smp_lock.h>
#include <linux/seq_file.h>
#include <linux/times.h>
+#include <linux/vmalloc.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
@@ -126,6 +127,41 @@
return proc_calc_metrics(page, start, off, count, eof, len);
}
+struct vmalloc_info {
+ unsigned long used;
+ unsigned long largest_chunk;
+};
+
+static struct vmalloc_info get_vmalloc_info(void)
+{
+ unsigned long addr = VMALLOC_START;
+ struct vm_struct** p;
+ struct vm_struct* tmp;
+ struct vmalloc_info vmi;
+ vmi.used = 0;
+
+ read_lock(&vmlist_lock);
+ if( !vmlist ) {
+ vmi.largest_chunk = (unsigned long)vmlist->addr-VMALLOC_START;
+ } else {
+ vmi.largest_chunk = 0;
+ }
+
+ for (p = &vmlist; (tmp = *p) ;p = &tmp->next) {
+ unsigned long free_area_size =
+ (unsigned long)tmp->addr - (unsigned long)addr;
+ vmi.used += tmp->size;
+ if (vmi.largest_chunk < free_area_size ) {
+ vmi.largest_chunk = free_area_size;
+ }
+ addr = tmp->size + (unsigned long)tmp->addr;
+ }
+ if( VMALLOC_END-addr > vmi.largest_chunk )
+ vmi.largest_chunk = (VMALLOC_END-addr);
+ read_unlock(&vmlist_lock);
+ return vmi;
+}
+
extern atomic_t vm_committed_space;
static int meminfo_read_proc(char *page, char **start, off_t off,
@@ -134,7 +170,9 @@
struct sysinfo i;
int len, committed;
struct page_state ps;
-
+ unsigned long vmtot;
+ struct vmalloc_info vmi;
+
get_page_state(&ps);
/*
* display in kilobytes.
@@ -143,6 +181,11 @@
si_meminfo(&i);
si_swapinfo(&i);
committed = atomic_read(&vm_committed_space);
+
+ vmtot = (VMALLOC_END-VMALLOC_START)>>10;
+ vmi = get_vmalloc_info();
+ vmi.used >>= 10;
+ vmi.largest_chunk >>= 10;
/*
* Tagged format, for easy grepping and expansion.
@@ -165,7 +208,10 @@
"Writeback: %8lu kB\n"
"Committed_AS: %8u kB\n"
"PageTables: %8lu kB\n"
- "ReverseMaps: %8lu\n",
+ "ReverseMaps: %8lu\n"
+ "VmalTotal: %8lu kB\n"
+ "VmalUsed: %8lu kB\n"
+ "VmalChunk: %8lu kB\n",
K(i.totalram),
K(i.freeram),
K(i.sharedram),
@@ -183,7 +229,10 @@
K(ps.nr_writeback),
K(committed),
K(ps.nr_page_table_pages),
- ps.nr_reverse_maps
+ ps.nr_reverse_maps,
+ vmtot,
+ vmi.used,
+ vmi.largest_chunk
);
return proc_calc_metrics(page, start, off, count, eof, len);
reply other threads:[~2002-08-26 15:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3D6A4FBF.806F2D89@us.ibm.com \
--to=haveblue@us.ibm.com \
--cc=Martin.Bligh@us.ibm.com \
--cc=akpm@zip.com.au \
--cc=linux-mm@kvack.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 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.