Commit 5f6a6a9c authored by Alexey Dobriyan's avatar Alexey Dobriyan

proc: move /proc/vmallocinfo to mm/vmalloc.c

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Acked-by: default avatarChristoph Lameter <cl@linux-foundation.org>
parent 7b3c3a50
...@@ -132,31 +132,6 @@ static const struct file_operations proc_modules_operations = { ...@@ -132,31 +132,6 @@ static const struct file_operations proc_modules_operations = {
}; };
#endif #endif
#ifdef CONFIG_MMU
static int vmalloc_open(struct inode *inode, struct file *file)
{
unsigned int *ptr = NULL;
int ret;
if (NUMA_BUILD)
ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
ret = seq_open(file, &vmalloc_op);
if (!ret) {
struct seq_file *m = file->private_data;
m->private = ptr;
} else
kfree(ptr);
return ret;
}
static const struct file_operations proc_vmalloc_operations = {
.open = vmalloc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_private,
};
#endif
#ifdef CONFIG_PROC_PAGE_MONITOR #ifdef CONFIG_PROC_PAGE_MONITOR
#define KPMSIZE sizeof(u64) #define KPMSIZE sizeof(u64)
#define KPMMASK (KPMSIZE - 1) #define KPMMASK (KPMSIZE - 1)
...@@ -295,9 +270,6 @@ void __init proc_misc_init(void) ...@@ -295,9 +270,6 @@ void __init proc_misc_init(void)
proc_symlink("mounts", NULL, "self/mounts"); proc_symlink("mounts", NULL, "self/mounts");
/* And now for trickier ones */ /* And now for trickier ones */
#ifdef CONFIG_MMU
proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
#endif
proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
......
...@@ -103,6 +103,4 @@ extern void free_vm_area(struct vm_struct *area); ...@@ -103,6 +103,4 @@ extern void free_vm_area(struct vm_struct *area);
extern rwlock_t vmlist_lock; extern rwlock_t vmlist_lock;
extern struct vm_struct *vmlist; extern struct vm_struct *vmlist;
extern const struct seq_operations vmalloc_op;
#endif /* _LINUX_VMALLOC_H */ #endif /* _LINUX_VMALLOC_H */
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/debugobjects.h> #include <linux/debugobjects.h>
#include <linux/kallsyms.h> #include <linux/kallsyms.h>
...@@ -1718,11 +1719,41 @@ static int s_show(struct seq_file *m, void *p) ...@@ -1718,11 +1719,41 @@ static int s_show(struct seq_file *m, void *p)
return 0; return 0;
} }
const struct seq_operations vmalloc_op = { static const struct seq_operations vmalloc_op = {
.start = s_start, .start = s_start,
.next = s_next, .next = s_next,
.stop = s_stop, .stop = s_stop,
.show = s_show, .show = s_show,
}; };
static int vmalloc_open(struct inode *inode, struct file *file)
{
unsigned int *ptr = NULL;
int ret;
if (NUMA_BUILD)
ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
ret = seq_open(file, &vmalloc_op);
if (!ret) {
struct seq_file *m = file->private_data;
m->private = ptr;
} else
kfree(ptr);
return ret;
}
static const struct file_operations proc_vmalloc_operations = {
.open = vmalloc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_private,
};
static int __init proc_vmalloc_init(void)
{
proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
return 0;
}
module_init(proc_vmalloc_init);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment