diff options
Diffstat (limited to 'mm/vmalloc.c')
| -rw-r--r-- | mm/vmalloc.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0797589d51f8..036536945dd9 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
| @@ -15,9 +15,9 @@ | |||
| 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/vmalloc.h> | ||
| 21 | #include <linux/kallsyms.h> | 21 | #include <linux/kallsyms.h> |
| 22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
| 23 | #include <linux/rbtree.h> | 23 | #include <linux/rbtree.h> |
| @@ -1719,11 +1719,41 @@ static int s_show(struct seq_file *m, void *p) | |||
| 1719 | return 0; | 1719 | return 0; |
| 1720 | } | 1720 | } |
| 1721 | 1721 | ||
| 1722 | const struct seq_operations vmalloc_op = { | 1722 | static const struct seq_operations vmalloc_op = { |
| 1723 | .start = s_start, | 1723 | .start = s_start, |
| 1724 | .next = s_next, | 1724 | .next = s_next, |
| 1725 | .stop = s_stop, | 1725 | .stop = s_stop, |
| 1726 | .show = s_show, | 1726 | .show = s_show, |
| 1727 | }; | 1727 | }; |
| 1728 | |||
| 1729 | static 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 | |||
| 1745 | static 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 | |||
| 1752 | static int __init proc_vmalloc_init(void) | ||
| 1753 | { | ||
| 1754 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | ||
| 1755 | return 0; | ||
| 1756 | } | ||
| 1757 | module_init(proc_vmalloc_init); | ||
| 1728 | #endif | 1758 | #endif |
| 1729 | 1759 | ||
