cgroup: refactor allow_attach handler for 4.4
authorAmit Pundir <amit.pundir@linaro.org>
Mon, 21 Dec 2015 10:31:10 +0000 (16:01 +0530)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:53:46 +0000 (13:53 -0800)
Refactor *allow_attach() handler to align it with the changes
from mainline commit 1f7dd3e5a6e4 "cgroup: fix handling of
multi-destination migration from subtree_control enabling".

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
include/linux/cgroup-defs.h
include/linux/cgroup.h
kernel/cgroup.c
mm/memcontrol.c

index f3425da070e1aedab2b3d3ac5b97fcb510798cd0..4a4eea01956c108e43f849ce27a27dc2582d9ce4 100644 (file)
@@ -422,8 +422,7 @@ struct cgroup_subsys {
        void (*css_reset)(struct cgroup_subsys_state *css);
        void (*css_e_css_changed)(struct cgroup_subsys_state *css);
 
-       int (*allow_attach)(struct cgroup_subsys_state *css,
-                           struct cgroup_taskset *tset);
+       int (*allow_attach)(struct cgroup_taskset *tset);
        int (*can_attach)(struct cgroup_taskset *tset);
        void (*cancel_attach)(struct cgroup_taskset *tset);
        void (*attach)(struct cgroup_taskset *tset);
index 1cb19feddcb2f802eb9220d8f9c7b08bc858a95f..70358b9f5a7ab809be0dd1e6d5310c7588166ba7 100644 (file)
@@ -535,8 +535,7 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
  * running as root.
  * Returns 0 if this is allowed, or -EACCES otherwise.
  */
-int subsys_cgroup_allow_attach(struct cgroup_subsys_state *css,
-                              struct cgroup_taskset *tset);
+int subsys_cgroup_allow_attach(struct cgroup_taskset *tset);
 
 
 #else /* !CONFIG_CGROUPS */
@@ -563,8 +562,7 @@ static inline void cgroup_free(struct task_struct *p) {}
 static inline int cgroup_init_early(void) { return 0; }
 static inline int cgroup_init(void) { return 0; }
 
-static inline int subsys_cgroup_allow_attach(struct cgroup_subsys_state *css,
-                                            void *tset)
+static inline int subsys_cgroup_allow_attach(void *tset)
 {
        return -EINVAL;
 }
index 7fd423e550464f195af01bec6aedaec36d19a0b5..a57b7c86871ca969f16f31142d10d3746c8c284b 100644 (file)
@@ -2663,15 +2663,16 @@ static int cgroup_attach_task(struct cgroup *dst_cgrp,
        return ret;
 }
 
-int subsys_cgroup_allow_attach(struct cgroup_subsys_state *css, struct cgroup_taskset *tset)
+int subsys_cgroup_allow_attach(struct cgroup_taskset *tset)
 {
        const struct cred *cred = current_cred(), *tcred;
        struct task_struct *task;
+       struct cgroup_subsys_state *css;
 
        if (capable(CAP_SYS_NICE))
                return 0;
 
-       cgroup_taskset_for_each(task, tset) {
+       cgroup_taskset_for_each(task, css, tset) {
                tcred = __task_cred(task);
 
                if (current != task && !uid_eq(cred->euid, tcred->uid) &&
@@ -2690,7 +2691,7 @@ static int cgroup_allow_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
 
        for_each_css(css, i, cgrp) {
                if (css->ss->allow_attach) {
-                       ret = css->ss->allow_attach(css, tset);
+                       ret = css->ss->allow_attach(tset);
                        if (ret)
                                return ret;
                } else {
index 83b222be7d37aa932e91188c73107ef0ba46d467..e0e486323bf1455da04a4af221fe19dadb855f03 100644 (file)
@@ -4878,10 +4878,9 @@ static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
        return ret;
 }
 
-static int mem_cgroup_allow_attach(struct cgroup_subsys_state *css,
-                                  struct cgroup_taskset *tset)
+static int mem_cgroup_allow_attach(struct cgroup_taskset *tset)
 {
-       return subsys_cgroup_allow_attach(css, tset);
+       return subsys_cgroup_allow_attach(tset);
 }
 
 static void mem_cgroup_cancel_attach(struct cgroup_taskset *tset)
@@ -5045,8 +5044,7 @@ static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
 {
        return 0;
 }
-static int mem_cgroup_allow_attach(struct cgroup_subsys_state *css,
-                                  struct cgroup_taskset *tset)
+static int mem_cgroup_allow_attach(struct cgroup_taskset *tset)
 {
        return 0;
 }