cgroup: Fix issues in allow_attach callback
authorRom Lemarchand <romlem@android.com>
Wed, 27 May 2015 00:00:44 +0000 (17:00 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:53:44 +0000 (13:53 -0800)
- Return -EINVAL when cgroups support isn't enabled
- Add allow_attach callback in CPU cgroups

Change-Id: Id3360b4a39919524fc4b6fcbd44fa2050009f000
Signed-off-by: Rom Lemarchand <romlem@android.com>
include/linux/cgroup.h
kernel/sched/core.c

index c08c83182e086facfbd2d02db5f2eb87e45dd2fa..5c30867511cf1b90ad4c0bb200e7f4e5be3b67d6 100644 (file)
@@ -566,7 +566,7 @@ static inline int cgroup_init(void) { return 0; }
 static inline int subsys_cgroup_allow_attach(struct cgroup_subsys_state *css,
                                             struct cgroup_taskset *tset)
 {
-       return 0;
+       return -EINVAL;
 }
 #endif /* !CONFIG_CGROUPS */
 
index 67359c7f35db0c12b433ac440a16d8be729392cb..61b0914cc7aa08b5fad78d1efc3e11fa207e20de 100644 (file)
@@ -8609,6 +8609,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
        .fork           = cpu_cgroup_fork,
        .can_attach     = cpu_cgroup_can_attach,
        .attach         = cpu_cgroup_attach,
+       .allow_attach   = subsys_cgroup_allow_attach,
        .legacy_cftypes = cpu_files,
        .early_init     = 1,
 };