55ec97562f7493953ce131c6368118711ccc2288
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-omap4-2.6.35.7 / 0002-cgroupfs-create-sys-fs-cgroup-to-mount-cgroupfs-on.patch
1 From 64bc6f1bfac43096d0102be252392f31405273ec Mon Sep 17 00:00:00 2001
2 From: Greg KH <gregkh@suse.de>
3 Date: Thu, 5 Aug 2010 13:53:35 -0700
4 Subject: [PATCH 2/2] cgroupfs: create /sys/fs/cgroup to mount cgroupfs on
6 We really shouldn't be asking userspace to create new root filesystems.
7 So follow along with all of the other in-kernel filesystems, and provide
8 a mount point in sysfs.
10 For cgroupfs, this should be in /sys/fs/cgroup/  This change provides
11 that mount point when the cgroup filesystem is registered in the kernel.
13 Acked-by: Paul Menage <menage@google.com>
14 Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
15 Cc: Li Zefan <lizf@cn.fujitsu.com>
16 Cc: Lennart Poettering <lennart@poettering.net>
17 Cc: Kay Sievers <kay.sievers@vrfy.org>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19 ---
20  kernel/cgroup.c |   13 ++++++++++++-
21  1 files changed, 12 insertions(+), 1 deletions(-)
23 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
24 index 7a14a97..cd81c18 100644
25 --- a/kernel/cgroup.c
26 +++ b/kernel/cgroup.c
27 @@ -1621,6 +1621,8 @@ static struct file_system_type cgroup_fs_type = {
28         .kill_sb = cgroup_kill_sb,
29  };
30  
31 +static struct kobject *cgroup_kobj;
32 +
33  static inline struct cgroup *__d_cgrp(struct dentry *dentry)
34  {
35         return dentry->d_fsdata;
36 @@ -3885,9 +3887,18 @@ int __init cgroup_init(void)
37         hhead = css_set_hash(init_css_set.subsys);
38         hlist_add_head(&init_css_set.hlist, hhead);
39         BUG_ON(!init_root_id(&rootnode));
40 +
41 +       cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
42 +       if (!cgroup_kobj) {
43 +               err = -ENOMEM;
44 +               goto out;
45 +       }
46 +
47         err = register_filesystem(&cgroup_fs_type);
48 -       if (err < 0)
49 +       if (err < 0) {
50 +               kobject_put(cgroup_kobj);
51                 goto out;
52 +       }
53  
54         proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations);
55  
56 -- 
57 1.6.6.1