mm: create /sys/kernel/mm
authorNishanth Aravamudan <nacc@us.ibm.com>
Thu, 24 Jul 2008 04:27:39 +0000 (21:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:17 +0000 (10:47 -0700)
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>
Documentation/ABI/testing/sysfs-kernel-mm [new file with mode: 0644]
include/linux/kobject.h
mm/mm_init.c

diff --git a/Documentation/ABI/testing/sysfs-kernel-mm b/Documentation/ABI/testing/sysfs-kernel-mm
new file mode 100644 (file)
index 0000000..190d523
--- /dev/null
@@ -0,0 +1,6 @@
+What:          /sys/kernel/mm
+Date:          July 2008
+Contact:       Nishanth Aravamudan <nacc@us.ibm.com>, VM maintainers
+Description:
+               /sys/kernel/mm/ should contain any and all VM
+               related information in /sys/kernel/.
index 60f0d418ae3264c8684accf0f44cbab9c2db700e..5437ac0276e232d259a886e7b644f4b4e2e44935 100644 (file)
@@ -186,6 +186,8 @@ extern struct kobject *kset_find_obj(struct kset *, const char *);
 
 /* The global /sys/kernel/ kobject for people to chain off of */
 extern struct kobject *kernel_kobj;
+/* The global /sys/kernel/mm/ kobject for people to chain off of */
+extern struct kobject *mm_kobj;
 /* The global /sys/hypervisor/ kobject for people to chain off of */
 extern struct kobject *hypervisor_kobj;
 /* The global /sys/power/ kobject for people to chain off of */
index eaf0d3b47099a063da4106e2f2c55fcd5a90e776..c6af41ea9994e79826c78f75d1d61c01323be63b 100644 (file)
@@ -7,6 +7,8 @@
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/kobject.h>
+#include <linux/module.h>
 #include "internal.h"
 
 #ifdef CONFIG_DEBUG_MEMORY_INIT
@@ -134,3 +136,17 @@ static __init int set_mminit_loglevel(char *str)
 }
 early_param("mminit_loglevel", set_mminit_loglevel);
 #endif /* CONFIG_DEBUG_MEMORY_INIT */
+
+struct kobject *mm_kobj;
+EXPORT_SYMBOL_GPL(mm_kobj);
+
+static int __init mm_sysfs_init(void)
+{
+       mm_kobj = kobject_create_and_add("mm", kernel_kobj);
+       if (!mm_kobj)
+               return -ENOMEM;
+
+       return 0;
+}
+
+__initcall(mm_sysfs_init);