Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Unify /proc/slabinfo configuration

Both SLUB and SLAB really did almost exactly the same thing for
/proc/slabinfo setup, using duplicate code and per-allocator #ifdef's.

This just creates a common CONFIG_SLABINFO that is enabled by both SLUB
and SLAB, and shares all the setup code. Maybe SLOB will want this some
day too.

Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+23 -27
+2 -19
fs/proc/proc_misc.c
··· 410 410 }; 411 411 #endif 412 412 413 - #ifdef CONFIG_SLAB 413 + #ifdef CONFIG_SLABINFO 414 414 static int slabinfo_open(struct inode *inode, struct file *file) 415 415 { 416 416 return seq_open(file, &slabinfo_op); ··· 449 449 .release = seq_release_private, 450 450 }; 451 451 #endif 452 - #endif 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 452 #endif 467 453 468 454 static int show_stat(struct seq_file *p, void *v) ··· 728 742 #endif 729 743 create_seq_entry("stat", 0, &proc_stat_operations); 730 744 create_seq_entry("interrupts", 0, &proc_interrupts_operations); 731 - #ifdef CONFIG_SLAB 745 + #ifdef CONFIG_SLABINFO 732 746 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); 733 747 #ifdef CONFIG_DEBUG_SLAB_LEAK 734 748 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); 735 749 #endif 736 - #endif 737 - #ifdef CONFIG_SLUB 738 - create_seq_entry("slabinfo", S_IWUSR|S_IRUGO, &proc_slabinfo_operations); 739 750 #endif 740 751 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); 741 752 create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops);
+5
include/linux/slab.h
··· 271 271 return kmalloc(size, flags | __GFP_ZERO); 272 272 } 273 273 274 + #ifdef CONFIG_SLABINFO 275 + extern const struct seq_operations slabinfo_op; 276 + ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); 277 + #endif 278 + 274 279 #endif /* __KERNEL__ */ 275 280 #endif /* _LINUX_SLAB_H */
-3
include/linux/slab_def.h
··· 95 95 96 96 #endif /* CONFIG_NUMA */ 97 97 98 - extern const struct seq_operations slabinfo_op; 99 - ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); 100 - 101 98 #endif /* _LINUX_SLAB_DEF_H */
-2
include/linux/slub_def.h
··· 200 200 } 201 201 #endif 202 202 203 - extern const struct seq_operations slabinfo_op; 204 - 205 203 #endif /* _LINUX_SLUB_DEF_H */
+6
init/Kconfig
··· 658 658 659 659 endmenu # General setup 660 660 661 + config SLABINFO 662 + bool 663 + depends on PROC_FS 664 + depends on SLAB || SLUB 665 + default y 666 + 661 667 config RT_MUTEXES 662 668 boolean 663 669 select PLIST
+1 -1
mm/slab.c
··· 4105 4105 schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC)); 4106 4106 } 4107 4107 4108 - #ifdef CONFIG_PROC_FS 4108 + #ifdef CONFIG_SLABINFO 4109 4109 4110 4110 static void print_slabinfo_header(struct seq_file *m) 4111 4111 {
+9 -2
mm/slub.c
··· 4127 4127 /* 4128 4128 * The /proc/slabinfo ABI 4129 4129 */ 4130 - #ifdef CONFIG_PROC_FS 4130 + #ifdef CONFIG_SLABINFO 4131 + 4132 + ssize_t slabinfo_write(struct file *file, const char __user * buffer, 4133 + size_t count, loff_t *ppos) 4134 + { 4135 + return -EINVAL; 4136 + } 4137 + 4131 4138 4132 4139 static void print_slabinfo_header(struct seq_file *m) 4133 4140 { ··· 4208 4201 .show = s_show, 4209 4202 }; 4210 4203 4211 - #endif /* CONFIG_PROC_FS */ 4204 + #endif /* CONFIG_SLABINFO */