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

mm: create /sys/kernel/mm

Add a kobject to create /sys/kernel/mm when sysfs is mounted. The kobject
will exist regardless. This will allow for the hugepage related sysfs
directories to exist under the mm "subsystem" directory. Add an ABI file
appropriately.

[kosaki.motohiro@jp.fujitsu.com: fix build]
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Nishanth Aravamudan and committed by
Linus Torvalds
ff7ea79c 5e9426ab

+24
+6
Documentation/ABI/testing/sysfs-kernel-mm
··· 1 + What: /sys/kernel/mm 2 + Date: July 2008 3 + Contact: Nishanth Aravamudan <nacc@us.ibm.com>, VM maintainers 4 + Description: 5 + /sys/kernel/mm/ should contain any and all VM 6 + related information in /sys/kernel/.
+2
include/linux/kobject.h
··· 186 186 187 187 /* The global /sys/kernel/ kobject for people to chain off of */ 188 188 extern struct kobject *kernel_kobj; 189 + /* The global /sys/kernel/mm/ kobject for people to chain off of */ 190 + extern struct kobject *mm_kobj; 189 191 /* The global /sys/hypervisor/ kobject for people to chain off of */ 190 192 extern struct kobject *hypervisor_kobj; 191 193 /* The global /sys/power/ kobject for people to chain off of */
+16
mm/mm_init.c
··· 7 7 */ 8 8 #include <linux/kernel.h> 9 9 #include <linux/init.h> 10 + #include <linux/kobject.h> 11 + #include <linux/module.h> 10 12 #include "internal.h" 11 13 12 14 #ifdef CONFIG_DEBUG_MEMORY_INIT ··· 136 134 } 137 135 early_param("mminit_loglevel", set_mminit_loglevel); 138 136 #endif /* CONFIG_DEBUG_MEMORY_INIT */ 137 + 138 + struct kobject *mm_kobj; 139 + EXPORT_SYMBOL_GPL(mm_kobj); 140 + 141 + static int __init mm_sysfs_init(void) 142 + { 143 + mm_kobj = kobject_create_and_add("mm", kernel_kobj); 144 + if (!mm_kobj) 145 + return -ENOMEM; 146 + 147 + return 0; 148 + } 149 + 150 + __initcall(mm_sysfs_init);