diff options
-rw-r--r-- | fs/proc/proc_misc.c | 17 | ||||
-rw-r--r-- | include/linux/slab.h | 5 | ||||
-rw-r--r-- | mm/slab.c | 16 | ||||
-rw-r--r-- | mm/slub.c | 29 |
4 files changed, 35 insertions, 32 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 5bca02842d07..1d6d5c5cc2a8 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -132,20 +132,6 @@ static const struct file_operations proc_modules_operations = { | |||
132 | }; | 132 | }; |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | #ifdef CONFIG_SLABINFO | ||
136 | static int slabinfo_open(struct inode *inode, struct file *file) | ||
137 | { | ||
138 | return seq_open(file, &slabinfo_op); | ||
139 | } | ||
140 | static const struct file_operations proc_slabinfo_operations = { | ||
141 | .open = slabinfo_open, | ||
142 | .read = seq_read, | ||
143 | .write = slabinfo_write, | ||
144 | .llseek = seq_lseek, | ||
145 | .release = seq_release, | ||
146 | }; | ||
147 | #endif | ||
148 | |||
149 | #ifdef CONFIG_MMU | 135 | #ifdef CONFIG_MMU |
150 | static int vmalloc_open(struct inode *inode, struct file *file) | 136 | static int vmalloc_open(struct inode *inode, struct file *file) |
151 | { | 137 | { |
@@ -309,9 +295,6 @@ void __init proc_misc_init(void) | |||
309 | proc_symlink("mounts", NULL, "self/mounts"); | 295 | proc_symlink("mounts", NULL, "self/mounts"); |
310 | 296 | ||
311 | /* And now for trickier ones */ | 297 | /* And now for trickier ones */ |
312 | #ifdef CONFIG_SLABINFO | ||
313 | proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); | ||
314 | #endif | ||
315 | #ifdef CONFIG_MMU | 298 | #ifdef CONFIG_MMU |
316 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | 299 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); |
317 | #endif | 300 | #endif |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 5ff9676c1e2c..ba965c84ae06 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -288,9 +288,4 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node) | |||
288 | return kmalloc_node(size, flags | __GFP_ZERO, node); | 288 | return kmalloc_node(size, flags | __GFP_ZERO, node); |
289 | } | 289 | } |
290 | 290 | ||
291 | #ifdef CONFIG_SLABINFO | ||
292 | extern const struct seq_operations slabinfo_op; | ||
293 | ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); | ||
294 | #endif | ||
295 | |||
296 | #endif /* _LINUX_SLAB_H */ | 291 | #endif /* _LINUX_SLAB_H */ |
@@ -4259,7 +4259,7 @@ static int s_show(struct seq_file *m, void *p) | |||
4259 | * + further values on SMP and with statistics enabled | 4259 | * + further values on SMP and with statistics enabled |
4260 | */ | 4260 | */ |
4261 | 4261 | ||
4262 | const struct seq_operations slabinfo_op = { | 4262 | static const struct seq_operations slabinfo_op = { |
4263 | .start = s_start, | 4263 | .start = s_start, |
4264 | .next = s_next, | 4264 | .next = s_next, |
4265 | .stop = s_stop, | 4265 | .stop = s_stop, |
@@ -4316,6 +4316,19 @@ ssize_t slabinfo_write(struct file *file, const char __user * buffer, | |||
4316 | return res; | 4316 | return res; |
4317 | } | 4317 | } |
4318 | 4318 | ||
4319 | static int slabinfo_open(struct inode *inode, struct file *file) | ||
4320 | { | ||
4321 | return seq_open(file, &slabinfo_op); | ||
4322 | } | ||
4323 | |||
4324 | static const struct file_operations proc_slabinfo_operations = { | ||
4325 | .open = slabinfo_open, | ||
4326 | .read = seq_read, | ||
4327 | .write = slabinfo_write, | ||
4328 | .llseek = seq_lseek, | ||
4329 | .release = seq_release, | ||
4330 | }; | ||
4331 | |||
4319 | #ifdef CONFIG_DEBUG_SLAB_LEAK | 4332 | #ifdef CONFIG_DEBUG_SLAB_LEAK |
4320 | 4333 | ||
4321 | static void *leaks_start(struct seq_file *m, loff_t *pos) | 4334 | static void *leaks_start(struct seq_file *m, loff_t *pos) |
@@ -4478,6 +4491,7 @@ static const struct file_operations proc_slabstats_operations = { | |||
4478 | 4491 | ||
4479 | static int __init slab_proc_init(void) | 4492 | static int __init slab_proc_init(void) |
4480 | { | 4493 | { |
4494 | proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); | ||
4481 | #ifdef CONFIG_DEBUG_SLAB_LEAK | 4495 | #ifdef CONFIG_DEBUG_SLAB_LEAK |
4482 | proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations); | 4496 | proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations); |
4483 | #endif | 4497 | #endif |
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/proc_fs.h> | ||
17 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
18 | #include <linux/cpu.h> | 19 | #include <linux/cpu.h> |
19 | #include <linux/cpuset.h> | 20 | #include <linux/cpuset.h> |
@@ -4417,14 +4418,6 @@ __initcall(slab_sysfs_init); | |||
4417 | * The /proc/slabinfo ABI | 4418 | * The /proc/slabinfo ABI |
4418 | */ | 4419 | */ |
4419 | #ifdef CONFIG_SLABINFO | 4420 | #ifdef CONFIG_SLABINFO |
4420 | |||
4421 | ssize_t slabinfo_write(struct file *file, const char __user *buffer, | ||
4422 | size_t count, loff_t *ppos) | ||
4423 | { | ||
4424 | return -EINVAL; | ||
4425 | } | ||
4426 | |||
4427 | |||
4428 | static void print_slabinfo_header(struct seq_file *m) | 4421 | static void print_slabinfo_header(struct seq_file *m) |
4429 | { | 4422 | { |
4430 | seq_puts(m, "slabinfo - version: 2.1\n"); | 4423 | seq_puts(m, "slabinfo - version: 2.1\n"); |
@@ -4492,11 +4485,29 @@ static int s_show(struct seq_file *m, void *p) | |||
4492 | return 0; | 4485 | return 0; |
4493 | } | 4486 | } |
4494 | 4487 | ||
4495 | const struct seq_operations slabinfo_op = { | 4488 | static const struct seq_operations slabinfo_op = { |
4496 | .start = s_start, | 4489 | .start = s_start, |
4497 | .next = s_next, | 4490 | .next = s_next, |
4498 | .stop = s_stop, | 4491 | .stop = s_stop, |
4499 | .show = s_show, | 4492 | .show = s_show, |
4500 | }; | 4493 | }; |
4501 | 4494 | ||
4495 | static int slabinfo_open(struct inode *inode, struct file *file) | ||
4496 | { | ||
4497 | return seq_open(file, &slabinfo_op); | ||
4498 | } | ||
4499 | |||
4500 | static const struct file_operations proc_slabinfo_operations = { | ||
4501 | .open = slabinfo_open, | ||
4502 | .read = seq_read, | ||
4503 | .llseek = seq_lseek, | ||
4504 | .release = seq_release, | ||
4505 | }; | ||
4506 | |||
4507 | static int __init slab_proc_init(void) | ||
4508 | { | ||
4509 | proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); | ||
4510 | return 0; | ||
4511 | } | ||
4512 | module_init(slab_proc_init); | ||
4502 | #endif /* CONFIG_SLABINFO */ | 4513 | #endif /* CONFIG_SLABINFO */ |