Commit 6b6adc22a01941165d5af9a3e69e28e948b28f47

Authored by Pekka Enberg
Committed by Linus Torvalds
1 parent dc512814b5

slub: register slabinfo to procfs

We need to register slabinfo to procfs when CONFIG_SLUB is enabled to
make the file actually visible to user-space.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 17 additions and 0 deletions Side-by-side Diff

... ... @@ -451,6 +451,20 @@
451 451 #endif
452 452 #endif
453 453  
  454 +#ifdef CONFIG_SLUB
  455 +static int slabinfo_open(struct inode *inode, struct file *file)
  456 +{
  457 + return seq_open(file, &slabinfo_op);
  458 +}
  459 +
  460 +static const struct file_operations proc_slabinfo_operations = {
  461 + .open = slabinfo_open,
  462 + .read = seq_read,
  463 + .llseek = seq_lseek,
  464 + .release = seq_release,
  465 +};
  466 +#endif
  467 +
454 468 static int show_stat(struct seq_file *p, void *v)
455 469 {
456 470 int i;
... ... @@ -733,6 +747,9 @@
733 747 #ifdef CONFIG_DEBUG_SLAB_LEAK
734 748 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
735 749 #endif
  750 +#endif
  751 +#ifdef CONFIG_SLUB
  752 + create_seq_entry("slabinfo", S_IWUSR|S_IRUGO, &proc_slabinfo_operations);
736 753 #endif
737 754 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
738 755 create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops);