aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 15:04:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 15:04:37 -0400
commit88ed86fee6651033de9b7038dac7869a9f19775a (patch)
tree38b638d2e7cba110ec271275738f221feb7e0a37 /mm/vmalloc.c
parent3856d30ded1fe43c6657927ebad402d25cd128f4 (diff)
parent59c7572e82d69483a66eaa67b46548baeb69ecf4 (diff)
Merge branch 'proc' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan/proc
* 'proc' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan/proc: (35 commits) proc: remove fs/proc/proc_misc.c proc: move /proc/vmcore creation to fs/proc/vmcore.c proc: move pagecount stuff to fs/proc/page.c proc: move all /proc/kcore stuff to fs/proc/kcore.c proc: move /proc/schedstat boilerplate to kernel/sched_stats.h proc: move /proc/modules boilerplate to kernel/module.c proc: move /proc/diskstats boilerplate to block/genhd.c proc: move /proc/zoneinfo boilerplate to mm/vmstat.c proc: move /proc/vmstat boilerplate to mm/vmstat.c proc: move /proc/pagetypeinfo boilerplate to mm/vmstat.c proc: move /proc/buddyinfo boilerplate to mm/vmstat.c proc: move /proc/vmallocinfo to mm/vmalloc.c proc: move /proc/slabinfo boilerplate to mm/slub.c, mm/slab.c proc: move /proc/slab_allocators boilerplate to mm/slab.c proc: move /proc/interrupts boilerplate code to fs/proc/interrupts.c proc: move /proc/stat to fs/proc/stat.c proc: move rest of /proc/partitions code to block/genhd.c proc: move /proc/cpuinfo code to fs/proc/cpuinfo.c proc: move /proc/devices code to fs/proc/devices.c proc: move rest of /proc/locks to fs/locks.c ...
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 65ae576030da..036536945dd9 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -15,6 +15,7 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/proc_fs.h>
18#include <linux/seq_file.h> 19#include <linux/seq_file.h>
19#include <linux/debugobjects.h> 20#include <linux/debugobjects.h>
20#include <linux/kallsyms.h> 21#include <linux/kallsyms.h>
@@ -1718,11 +1719,41 @@ static int s_show(struct seq_file *m, void *p)
1718 return 0; 1719 return 0;
1719} 1720}
1720 1721
1721const struct seq_operations vmalloc_op = { 1722static const struct seq_operations vmalloc_op = {
1722 .start = s_start, 1723 .start = s_start,
1723 .next = s_next, 1724 .next = s_next,
1724 .stop = s_stop, 1725 .stop = s_stop,
1725 .show = s_show, 1726 .show = s_show,
1726}; 1727};
1728
1729static int vmalloc_open(struct inode *inode, struct file *file)
1730{
1731 unsigned int *ptr = NULL;
1732 int ret;
1733
1734 if (NUMA_BUILD)
1735 ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
1736 ret = seq_open(file, &vmalloc_op);
1737 if (!ret) {
1738 struct seq_file *m = file->private_data;
1739 m->private = ptr;
1740 } else
1741 kfree(ptr);
1742 return ret;
1743}
1744
1745static const struct file_operations proc_vmalloc_operations = {
1746 .open = vmalloc_open,
1747 .read = seq_read,
1748 .llseek = seq_lseek,
1749 .release = seq_release_private,
1750};
1751
1752static int __init proc_vmalloc_init(void)
1753{
1754 proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
1755 return 0;
1756}
1757module_init(proc_vmalloc_init);
1727#endif 1758#endif
1728 1759