diff options
author | Christoph Lameter <clameter@sgi.com> | 2008-04-28 05:12:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:21 -0400 |
commit | a10aa579878fc6f9cd17455067380bbdf1d53c91 (patch) | |
tree | c42fbb1e9422e5334c2207cafed4a2b5b1ad16c4 /fs | |
parent | b45445684198a946b587732265692e6495993abf (diff) |
vmalloc: show vmalloced areas via /proc/vmallocinfo
Implement a new proc file that allows the display of the currently allocated
vmalloc memory.
It allows to see the users of vmalloc. That is important if vmalloc space is
scarce (i386 for example).
And it's going to be important for the compound page fallback to vmalloc.
Many of the current users can be switched to use compound pages with fallback.
This means that the number of users of vmalloc is reduced and page tables no
longer necessary to access the memory. /proc/vmallocinfo allows to review how
that reduction occurs.
If memory becomes fragmented and larger order allocations are no longer
possible then /proc/vmallocinfo allows to see which compound page allocations
fell back to virtual compound pages. That is important for new users of
virtual compound pages. Such as order 1 stack allocation etc that may
fallback to virtual compound pages in the future.
/proc/vmallocinfo permissions are made readable-only-by-root to avoid possible
information leakage.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: CONFIG_MMU=n build fix]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/proc_misc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 2d563979cb02..441a32f0e5f2 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -456,6 +456,20 @@ static const struct file_operations proc_slabstats_operations = { | |||
456 | #endif | 456 | #endif |
457 | #endif | 457 | #endif |
458 | 458 | ||
459 | #ifdef CONFIG_MMU | ||
460 | static int vmalloc_open(struct inode *inode, struct file *file) | ||
461 | { | ||
462 | return seq_open(file, &vmalloc_op); | ||
463 | } | ||
464 | |||
465 | static const struct file_operations proc_vmalloc_operations = { | ||
466 | .open = vmalloc_open, | ||
467 | .read = seq_read, | ||
468 | .llseek = seq_lseek, | ||
469 | .release = seq_release, | ||
470 | }; | ||
471 | #endif | ||
472 | |||
459 | static int show_stat(struct seq_file *p, void *v) | 473 | static int show_stat(struct seq_file *p, void *v) |
460 | { | 474 | { |
461 | int i; | 475 | int i; |
@@ -869,6 +883,9 @@ void __init proc_misc_init(void) | |||
869 | create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); | 883 | create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); |
870 | #endif | 884 | #endif |
871 | #endif | 885 | #endif |
886 | #ifdef CONFIG_MMU | ||
887 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | ||
888 | #endif | ||
872 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | 889 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); |
873 | create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops); | 890 | create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops); |
874 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | 891 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); |