diff options
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7a10742b389a..622b7efc5ade 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -7094,16 +7094,17 @@ static inline struct task_group *cgroup_tg(struct cgroup *cgrp) | |||
7094 | return css_tg(cgroup_css(cgrp, cpu_cgroup_subsys_id)); | 7094 | return css_tg(cgroup_css(cgrp, cpu_cgroup_subsys_id)); |
7095 | } | 7095 | } |
7096 | 7096 | ||
7097 | static struct cgroup_subsys_state *cpu_cgroup_css_alloc(struct cgroup *cgrp) | 7097 | static struct cgroup_subsys_state * |
7098 | cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) | ||
7098 | { | 7099 | { |
7099 | struct task_group *tg, *parent; | 7100 | struct task_group *parent = css_tg(parent_css); |
7101 | struct task_group *tg; | ||
7100 | 7102 | ||
7101 | if (!cgrp->parent) { | 7103 | if (!parent) { |
7102 | /* This is early initialization for the top cgroup */ | 7104 | /* This is early initialization for the top cgroup */ |
7103 | return &root_task_group.css; | 7105 | return &root_task_group.css; |
7104 | } | 7106 | } |
7105 | 7107 | ||
7106 | parent = cgroup_tg(cgrp->parent); | ||
7107 | tg = sched_create_group(parent); | 7108 | tg = sched_create_group(parent); |
7108 | if (IS_ERR(tg)) | 7109 | if (IS_ERR(tg)) |
7109 | return ERR_PTR(-ENOMEM); | 7110 | return ERR_PTR(-ENOMEM); |
@@ -7111,38 +7112,38 @@ static struct cgroup_subsys_state *cpu_cgroup_css_alloc(struct cgroup *cgrp) | |||
7111 | return &tg->css; | 7112 | return &tg->css; |
7112 | } | 7113 | } |
7113 | 7114 | ||
7114 | static int cpu_cgroup_css_online(struct cgroup *cgrp) | 7115 | static int cpu_cgroup_css_online(struct cgroup_subsys_state *css) |
7115 | { | 7116 | { |
7116 | struct task_group *tg = cgroup_tg(cgrp); | 7117 | struct task_group *tg = css_tg(css); |
7117 | struct task_group *parent = css_tg(css_parent(&tg->css)); | 7118 | struct task_group *parent = css_tg(css_parent(css)); |
7118 | 7119 | ||
7119 | if (parent) | 7120 | if (parent) |
7120 | sched_online_group(tg, parent); | 7121 | sched_online_group(tg, parent); |
7121 | return 0; | 7122 | return 0; |
7122 | } | 7123 | } |
7123 | 7124 | ||
7124 | static void cpu_cgroup_css_free(struct cgroup *cgrp) | 7125 | static void cpu_cgroup_css_free(struct cgroup_subsys_state *css) |
7125 | { | 7126 | { |
7126 | struct task_group *tg = cgroup_tg(cgrp); | 7127 | struct task_group *tg = css_tg(css); |
7127 | 7128 | ||
7128 | sched_destroy_group(tg); | 7129 | sched_destroy_group(tg); |
7129 | } | 7130 | } |
7130 | 7131 | ||
7131 | static void cpu_cgroup_css_offline(struct cgroup *cgrp) | 7132 | static void cpu_cgroup_css_offline(struct cgroup_subsys_state *css) |
7132 | { | 7133 | { |
7133 | struct task_group *tg = cgroup_tg(cgrp); | 7134 | struct task_group *tg = css_tg(css); |
7134 | 7135 | ||
7135 | sched_offline_group(tg); | 7136 | sched_offline_group(tg); |
7136 | } | 7137 | } |
7137 | 7138 | ||
7138 | static int cpu_cgroup_can_attach(struct cgroup *cgrp, | 7139 | static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, |
7139 | struct cgroup_taskset *tset) | 7140 | struct cgroup_taskset *tset) |
7140 | { | 7141 | { |
7141 | struct task_struct *task; | 7142 | struct task_struct *task; |
7142 | 7143 | ||
7143 | cgroup_taskset_for_each(task, cgrp, tset) { | 7144 | cgroup_taskset_for_each(task, css->cgroup, tset) { |
7144 | #ifdef CONFIG_RT_GROUP_SCHED | 7145 | #ifdef CONFIG_RT_GROUP_SCHED |
7145 | if (!sched_rt_can_attach(cgroup_tg(cgrp), task)) | 7146 | if (!sched_rt_can_attach(css_tg(css), task)) |
7146 | return -EINVAL; | 7147 | return -EINVAL; |
7147 | #else | 7148 | #else |
7148 | /* We don't support RT-tasks being in separate groups */ | 7149 | /* We don't support RT-tasks being in separate groups */ |
@@ -7153,18 +7154,18 @@ static int cpu_cgroup_can_attach(struct cgroup *cgrp, | |||
7153 | return 0; | 7154 | return 0; |
7154 | } | 7155 | } |
7155 | 7156 | ||
7156 | static void cpu_cgroup_attach(struct cgroup *cgrp, | 7157 | static void cpu_cgroup_attach(struct cgroup_subsys_state *css, |
7157 | struct cgroup_taskset *tset) | 7158 | struct cgroup_taskset *tset) |
7158 | { | 7159 | { |
7159 | struct task_struct *task; | 7160 | struct task_struct *task; |
7160 | 7161 | ||
7161 | cgroup_taskset_for_each(task, cgrp, tset) | 7162 | cgroup_taskset_for_each(task, css->cgroup, tset) |
7162 | sched_move_task(task); | 7163 | sched_move_task(task); |
7163 | } | 7164 | } |
7164 | 7165 | ||
7165 | static void | 7166 | static void cpu_cgroup_exit(struct cgroup_subsys_state *css, |
7166 | cpu_cgroup_exit(struct cgroup *cgrp, struct cgroup *old_cgrp, | 7167 | struct cgroup_subsys_state *old_css, |
7167 | struct task_struct *task) | 7168 | struct task_struct *task) |
7168 | { | 7169 | { |
7169 | /* | 7170 | /* |
7170 | * cgroup_exit() is called in the copy_process() failure path. | 7171 | * cgroup_exit() is called in the copy_process() failure path. |