aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/core.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4d872e19244b..2a87bdde8d4e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7536,7 +7536,7 @@ void set_curr_task(int cpu, struct task_struct *p)
7536/* task_group_lock serializes the addition/removal of task groups */ 7536/* task_group_lock serializes the addition/removal of task groups */
7537static DEFINE_SPINLOCK(task_group_lock); 7537static DEFINE_SPINLOCK(task_group_lock);
7538 7538
7539static void free_sched_group(struct task_group *tg) 7539static void sched_free_group(struct task_group *tg)
7540{ 7540{
7541 free_fair_sched_group(tg); 7541 free_fair_sched_group(tg);
7542 free_rt_sched_group(tg); 7542 free_rt_sched_group(tg);
@@ -7562,7 +7562,7 @@ struct task_group *sched_create_group(struct task_group *parent)
7562 return tg; 7562 return tg;
7563 7563
7564err: 7564err:
7565 free_sched_group(tg); 7565 sched_free_group(tg);
7566 return ERR_PTR(-ENOMEM); 7566 return ERR_PTR(-ENOMEM);
7567} 7567}
7568 7568
@@ -7582,17 +7582,16 @@ void sched_online_group(struct task_group *tg, struct task_group *parent)
7582} 7582}
7583 7583
7584/* rcu callback to free various structures associated with a task group */ 7584/* rcu callback to free various structures associated with a task group */
7585static void free_sched_group_rcu(struct rcu_head *rhp) 7585static void sched_free_group_rcu(struct rcu_head *rhp)
7586{ 7586{
7587 /* now it should be safe to free those cfs_rqs */ 7587 /* now it should be safe to free those cfs_rqs */
7588 free_sched_group(container_of(rhp, struct task_group, rcu)); 7588 sched_free_group(container_of(rhp, struct task_group, rcu));
7589} 7589}
7590 7590
7591/* Destroy runqueue etc associated with a task group */
7592void sched_destroy_group(struct task_group *tg) 7591void sched_destroy_group(struct task_group *tg)
7593{ 7592{
7594 /* wait for possible concurrent references to cfs_rqs complete */ 7593 /* wait for possible concurrent references to cfs_rqs complete */
7595 call_rcu(&tg->rcu, free_sched_group_rcu); 7594 call_rcu(&tg->rcu, sched_free_group_rcu);
7596} 7595}
7597 7596
7598void sched_offline_group(struct task_group *tg) 7597void sched_offline_group(struct task_group *tg)
@@ -8051,31 +8050,26 @@ cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
8051 if (IS_ERR(tg)) 8050 if (IS_ERR(tg))
8052 return ERR_PTR(-ENOMEM); 8051 return ERR_PTR(-ENOMEM);
8053 8052
8053 sched_online_group(tg, parent);
8054
8054 return &tg->css; 8055 return &tg->css;
8055} 8056}
8056 8057
8057static int cpu_cgroup_css_online(struct cgroup_subsys_state *css) 8058static void cpu_cgroup_css_released(struct cgroup_subsys_state *css)
8058{ 8059{
8059 struct task_group *tg = css_tg(css); 8060 struct task_group *tg = css_tg(css);
8060 struct task_group *parent = css_tg(css->parent);
8061 8061
8062 if (parent) 8062 sched_offline_group(tg);
8063 sched_online_group(tg, parent);
8064 return 0;
8065} 8063}
8066 8064
8067static void cpu_cgroup_css_free(struct cgroup_subsys_state *css) 8065static void cpu_cgroup_css_free(struct cgroup_subsys_state *css)
8068{ 8066{
8069 struct task_group *tg = css_tg(css); 8067 struct task_group *tg = css_tg(css);
8070 8068
8071 sched_destroy_group(tg); 8069 /*
8072} 8070 * Relies on the RCU grace period between css_released() and this.
8073 8071 */
8074static void cpu_cgroup_css_offline(struct cgroup_subsys_state *css) 8072 sched_free_group(tg);
8075{
8076 struct task_group *tg = css_tg(css);
8077
8078 sched_offline_group(tg);
8079} 8073}
8080 8074
8081static void cpu_cgroup_fork(struct task_struct *task) 8075static void cpu_cgroup_fork(struct task_struct *task)
@@ -8435,9 +8429,8 @@ static struct cftype cpu_files[] = {
8435 8429
8436struct cgroup_subsys cpu_cgrp_subsys = { 8430struct cgroup_subsys cpu_cgrp_subsys = {
8437 .css_alloc = cpu_cgroup_css_alloc, 8431 .css_alloc = cpu_cgroup_css_alloc,
8432 .css_released = cpu_cgroup_css_released,
8438 .css_free = cpu_cgroup_css_free, 8433 .css_free = cpu_cgroup_css_free,
8439 .css_online = cpu_cgroup_css_online,
8440 .css_offline = cpu_cgroup_css_offline,
8441 .fork = cpu_cgroup_fork, 8434 .fork = cpu_cgroup_fork,
8442 .can_attach = cpu_cgroup_can_attach, 8435 .can_attach = cpu_cgroup_can_attach,
8443 .attach = cpu_cgroup_attach, 8436 .attach = cpu_cgroup_attach,