aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/inode.c3
-rw-r--r--fs/proc/proc_misc.c37
2 files changed, 39 insertions, 1 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 075d3e945602..722b9c463111 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -121,7 +121,8 @@ int __init proc_init_inodecache(void)
121{ 121{
122 proc_inode_cachep = kmem_cache_create("proc_inode_cache", 122 proc_inode_cachep = kmem_cache_create("proc_inode_cache",
123 sizeof(struct proc_inode), 123 sizeof(struct proc_inode),
124 0, SLAB_RECLAIM_ACCOUNT, 124 0, (SLAB_RECLAIM_ACCOUNT|
125 SLAB_MEM_SPREAD),
125 init_once, NULL); 126 init_once, NULL);
126 if (proc_inode_cachep == NULL) 127 if (proc_inode_cachep == NULL)
127 return -ENOMEM; 128 return -ENOMEM;
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 826c131994c3..1e9ea37d457e 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -485,6 +485,40 @@ static struct file_operations proc_slabinfo_operations = {
485 .llseek = seq_lseek, 485 .llseek = seq_lseek,
486 .release = seq_release, 486 .release = seq_release,
487}; 487};
488
489#ifdef CONFIG_DEBUG_SLAB_LEAK
490extern struct seq_operations slabstats_op;
491static int slabstats_open(struct inode *inode, struct file *file)
492{
493 unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
494 int ret = -ENOMEM;
495 if (n) {
496 ret = seq_open(file, &slabstats_op);
497 if (!ret) {
498 struct seq_file *m = file->private_data;
499 *n = PAGE_SIZE / (2 * sizeof(unsigned long));
500 m->private = n;
501 n = NULL;
502 }
503 kfree(n);
504 }
505 return ret;
506}
507
508static int slabstats_release(struct inode *inode, struct file *file)
509{
510 struct seq_file *m = file->private_data;
511 kfree(m->private);
512 return seq_release(inode, file);
513}
514
515static struct file_operations proc_slabstats_operations = {
516 .open = slabstats_open,
517 .read = seq_read,
518 .llseek = seq_lseek,
519 .release = slabstats_release,
520};
521#endif
488#endif 522#endif
489 523
490static int show_stat(struct seq_file *p, void *v) 524static int show_stat(struct seq_file *p, void *v)
@@ -744,6 +778,9 @@ void __init proc_misc_init(void)
744 create_seq_entry("interrupts", 0, &proc_interrupts_operations); 778 create_seq_entry("interrupts", 0, &proc_interrupts_operations);
745#ifdef CONFIG_SLAB 779#ifdef CONFIG_SLAB
746 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); 780 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
781#ifdef CONFIG_DEBUG_SLAB_LEAK
782 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
783#endif
747#endif 784#endif
748 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); 785 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
749 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); 786 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);