Skip to content

Commit ff7ea79

Browse files
Nishanth Aravamudantorvalds
authored andcommitted
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>
1 parent 5e9426a commit ff7ea79

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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/.

‎include/linux/kobject.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ extern struct kobject *kset_find_obj(struct kset *, const char *);
186186

187187
/* The global /sys/kernel/ kobject for people to chain off of */
188188
extern struct kobject *kernel_kobj;
189+
/* The global /sys/kernel/mm/ kobject for people to chain off of */
190+
extern struct kobject *mm_kobj;
189191
/* The global /sys/hypervisor/ kobject for people to chain off of */
190192
extern struct kobject *hypervisor_kobj;
191193
/* The global /sys/power/ kobject for people to chain off of */

‎mm/mm_init.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
#include <linux/kernel.h>
99
#include <linux/init.h>
10+
#include <linux/kobject.h>
11+
#include <linux/module.h>
1012
#include "internal.h"
1113

1214
#ifdef CONFIG_DEBUG_MEMORY_INIT
@@ -134,3 +136,17 @@ static __init int set_mminit_loglevel(char *str)
134136
}
135137
early_param("mminit_loglevel", set_mminit_loglevel);
136138
#endif /* CONFIG_DEBUG_MEMORY_INIT */
139+
140+
struct kobject *mm_kobj;
141+
EXPORT_SYMBOL_GPL(mm_kobj);
142+
143+
static int __init mm_sysfs_init(void)
144+
{
145+
mm_kobj = kobject_create_and_add("mm", kernel_kobj);
146+
if (!mm_kobj)
147+
return -ENOMEM;
148+
149+
return 0;
150+
}
151+
152+
__initcall(mm_sysfs_init);

0 commit comments

Comments
 (0)