|
@@ -233,7 +233,7 @@ static void destroy_rt_bandwidth(struct rt_bandwidth *rt_b)
|
|
*/
|
|
*/
|
|
static DEFINE_MUTEX(sched_domains_mutex);
|
|
static DEFINE_MUTEX(sched_domains_mutex);
|
|
|
|
|
|
-#ifdef CONFIG_GROUP_SCHED
|
|
|
|
|
|
+#ifdef CONFIG_CGROUP_SCHED
|
|
|
|
|
|
#include <linux/cgroup.h>
|
|
#include <linux/cgroup.h>
|
|
|
|
|
|
@@ -243,13 +243,7 @@ static LIST_HEAD(task_groups);
|
|
|
|
|
|
/* task group related information */
|
|
/* task group related information */
|
|
struct task_group {
|
|
struct task_group {
|
|
-#ifdef CONFIG_CGROUP_SCHED
|
|
|
|
struct cgroup_subsys_state css;
|
|
struct cgroup_subsys_state css;
|
|
-#endif
|
|
|
|
-
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- uid_t uid;
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
/* schedulable entities of this group on each cpu */
|
|
/* schedulable entities of this group on each cpu */
|
|
@@ -274,35 +268,7 @@ struct task_group {
|
|
struct list_head children;
|
|
struct list_head children;
|
|
};
|
|
};
|
|
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
-
|
|
|
|
-/* Helper function to pass uid information to create_sched_user() */
|
|
|
|
-void set_tg_uid(struct user_struct *user)
|
|
|
|
-{
|
|
|
|
- user->tg->uid = user->uid;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * Root task group.
|
|
|
|
- * Every UID task group (including init_task_group aka UID-0) will
|
|
|
|
- * be a child to this group.
|
|
|
|
- */
|
|
|
|
-struct task_group root_task_group;
|
|
|
|
-
|
|
|
|
-#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
|
|
-/* Default task group's sched entity on each cpu */
|
|
|
|
-static DEFINE_PER_CPU(struct sched_entity, init_sched_entity);
|
|
|
|
-/* Default task group's cfs_rq on each cpu */
|
|
|
|
-static DEFINE_PER_CPU_SHARED_ALIGNED(struct cfs_rq, init_tg_cfs_rq);
|
|
|
|
-#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
|
|
-
|
|
|
|
-#ifdef CONFIG_RT_GROUP_SCHED
|
|
|
|
-static DEFINE_PER_CPU(struct sched_rt_entity, init_sched_rt_entity);
|
|
|
|
-static DEFINE_PER_CPU_SHARED_ALIGNED(struct rt_rq, init_rt_rq_var);
|
|
|
|
-#endif /* CONFIG_RT_GROUP_SCHED */
|
|
|
|
-#else /* !CONFIG_USER_SCHED */
|
|
|
|
#define root_task_group init_task_group
|
|
#define root_task_group init_task_group
|
|
-#endif /* CONFIG_USER_SCHED */
|
|
|
|
|
|
|
|
/* task_group_lock serializes add/remove of task groups and also changes to
|
|
/* task_group_lock serializes add/remove of task groups and also changes to
|
|
* a task group's cpu shares.
|
|
* a task group's cpu shares.
|
|
@@ -318,11 +284,7 @@ static int root_task_group_empty(void)
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
-# define INIT_TASK_GROUP_LOAD (2*NICE_0_LOAD)
|
|
|
|
-#else /* !CONFIG_USER_SCHED */
|
|
|
|
# define INIT_TASK_GROUP_LOAD NICE_0_LOAD
|
|
# define INIT_TASK_GROUP_LOAD NICE_0_LOAD
|
|
-#endif /* CONFIG_USER_SCHED */
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
* A weight of 0 or 1 can cause arithmetics problems.
|
|
* A weight of 0 or 1 can cause arithmetics problems.
|
|
@@ -348,11 +310,7 @@ static inline struct task_group *task_group(struct task_struct *p)
|
|
{
|
|
{
|
|
struct task_group *tg;
|
|
struct task_group *tg;
|
|
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- rcu_read_lock();
|
|
|
|
- tg = __task_cred(p)->user->tg;
|
|
|
|
- rcu_read_unlock();
|
|
|
|
-#elif defined(CONFIG_CGROUP_SCHED)
|
|
|
|
|
|
+#ifdef CONFIG_CGROUP_SCHED
|
|
tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
|
|
tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
|
|
struct task_group, css);
|
|
struct task_group, css);
|
|
#else
|
|
#else
|
|
@@ -383,7 +341,7 @@ static inline struct task_group *task_group(struct task_struct *p)
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
-#endif /* CONFIG_GROUP_SCHED */
|
|
|
|
|
|
+#endif /* CONFIG_CGROUP_SCHED */
|
|
|
|
|
|
/* CFS-related fields in a runqueue */
|
|
/* CFS-related fields in a runqueue */
|
|
struct cfs_rq {
|
|
struct cfs_rq {
|
|
@@ -7678,9 +7636,6 @@ void __init sched_init(void)
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
alloc_size += 2 * nr_cpu_ids * sizeof(void **);
|
|
alloc_size += 2 * nr_cpu_ids * sizeof(void **);
|
|
#endif
|
|
#endif
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- alloc_size *= 2;
|
|
|
|
-#endif
|
|
|
|
#ifdef CONFIG_CPUMASK_OFFSTACK
|
|
#ifdef CONFIG_CPUMASK_OFFSTACK
|
|
alloc_size += num_possible_cpus() * cpumask_size();
|
|
alloc_size += num_possible_cpus() * cpumask_size();
|
|
#endif
|
|
#endif
|
|
@@ -7694,13 +7649,6 @@ void __init sched_init(void)
|
|
init_task_group.cfs_rq = (struct cfs_rq **)ptr;
|
|
init_task_group.cfs_rq = (struct cfs_rq **)ptr;
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- root_task_group.se = (struct sched_entity **)ptr;
|
|
|
|
- ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
-
|
|
|
|
- root_task_group.cfs_rq = (struct cfs_rq **)ptr;
|
|
|
|
- ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
-#endif /* CONFIG_USER_SCHED */
|
|
|
|
#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
init_task_group.rt_se = (struct sched_rt_entity **)ptr;
|
|
init_task_group.rt_se = (struct sched_rt_entity **)ptr;
|
|
@@ -7709,13 +7657,6 @@ void __init sched_init(void)
|
|
init_task_group.rt_rq = (struct rt_rq **)ptr;
|
|
init_task_group.rt_rq = (struct rt_rq **)ptr;
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- root_task_group.rt_se = (struct sched_rt_entity **)ptr;
|
|
|
|
- ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
-
|
|
|
|
- root_task_group.rt_rq = (struct rt_rq **)ptr;
|
|
|
|
- ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
-#endif /* CONFIG_USER_SCHED */
|
|
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
#ifdef CONFIG_CPUMASK_OFFSTACK
|
|
#ifdef CONFIG_CPUMASK_OFFSTACK
|
|
for_each_possible_cpu(i) {
|
|
for_each_possible_cpu(i) {
|
|
@@ -7735,22 +7676,13 @@ void __init sched_init(void)
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
init_rt_bandwidth(&init_task_group.rt_bandwidth,
|
|
init_rt_bandwidth(&init_task_group.rt_bandwidth,
|
|
global_rt_period(), global_rt_runtime());
|
|
global_rt_period(), global_rt_runtime());
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- init_rt_bandwidth(&root_task_group.rt_bandwidth,
|
|
|
|
- global_rt_period(), RUNTIME_INF);
|
|
|
|
-#endif /* CONFIG_USER_SCHED */
|
|
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
|
|
|
|
-#ifdef CONFIG_GROUP_SCHED
|
|
|
|
|
|
+#ifdef CONFIG_CGROUP_SCHED
|
|
list_add(&init_task_group.list, &task_groups);
|
|
list_add(&init_task_group.list, &task_groups);
|
|
INIT_LIST_HEAD(&init_task_group.children);
|
|
INIT_LIST_HEAD(&init_task_group.children);
|
|
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- INIT_LIST_HEAD(&root_task_group.children);
|
|
|
|
- init_task_group.parent = &root_task_group;
|
|
|
|
- list_add(&init_task_group.siblings, &root_task_group.children);
|
|
|
|
-#endif /* CONFIG_USER_SCHED */
|
|
|
|
-#endif /* CONFIG_GROUP_SCHED */
|
|
|
|
|
|
+#endif /* CONFIG_CGROUP_SCHED */
|
|
|
|
|
|
#if defined CONFIG_FAIR_GROUP_SCHED && defined CONFIG_SMP
|
|
#if defined CONFIG_FAIR_GROUP_SCHED && defined CONFIG_SMP
|
|
update_shares_data = __alloc_percpu(nr_cpu_ids * sizeof(unsigned long),
|
|
update_shares_data = __alloc_percpu(nr_cpu_ids * sizeof(unsigned long),
|
|
@@ -7790,25 +7722,6 @@ void __init sched_init(void)
|
|
* directly in rq->cfs (i.e init_task_group->se[] = NULL).
|
|
* directly in rq->cfs (i.e init_task_group->se[] = NULL).
|
|
*/
|
|
*/
|
|
init_tg_cfs_entry(&init_task_group, &rq->cfs, NULL, i, 1, NULL);
|
|
init_tg_cfs_entry(&init_task_group, &rq->cfs, NULL, i, 1, NULL);
|
|
-#elif defined CONFIG_USER_SCHED
|
|
|
|
- root_task_group.shares = NICE_0_LOAD;
|
|
|
|
- init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, 0, NULL);
|
|
|
|
- /*
|
|
|
|
- * In case of task-groups formed thr' the user id of tasks,
|
|
|
|
- * init_task_group represents tasks belonging to root user.
|
|
|
|
- * Hence it forms a sibling of all subsequent groups formed.
|
|
|
|
- * In this case, init_task_group gets only a fraction of overall
|
|
|
|
- * system cpu resource, based on the weight assigned to root
|
|
|
|
- * user's cpu share (INIT_TASK_GROUP_LOAD). This is accomplished
|
|
|
|
- * by letting tasks of init_task_group sit in a separate cfs_rq
|
|
|
|
- * (init_tg_cfs_rq) and having one entity represent this group of
|
|
|
|
- * tasks in rq->cfs (i.e init_task_group->se[] != NULL).
|
|
|
|
- */
|
|
|
|
- init_tg_cfs_entry(&init_task_group,
|
|
|
|
- &per_cpu(init_tg_cfs_rq, i),
|
|
|
|
- &per_cpu(init_sched_entity, i), i, 1,
|
|
|
|
- root_task_group.se[i]);
|
|
|
|
-
|
|
|
|
#endif
|
|
#endif
|
|
#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
|
|
|
|
@@ -7817,12 +7730,6 @@ void __init sched_init(void)
|
|
INIT_LIST_HEAD(&rq->leaf_rt_rq_list);
|
|
INIT_LIST_HEAD(&rq->leaf_rt_rq_list);
|
|
#ifdef CONFIG_CGROUP_SCHED
|
|
#ifdef CONFIG_CGROUP_SCHED
|
|
init_tg_rt_entry(&init_task_group, &rq->rt, NULL, i, 1, NULL);
|
|
init_tg_rt_entry(&init_task_group, &rq->rt, NULL, i, 1, NULL);
|
|
-#elif defined CONFIG_USER_SCHED
|
|
|
|
- init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, 0, NULL);
|
|
|
|
- init_tg_rt_entry(&init_task_group,
|
|
|
|
- &per_cpu(init_rt_rq_var, i),
|
|
|
|
- &per_cpu(init_sched_rt_entity, i), i, 1,
|
|
|
|
- root_task_group.rt_se[i]);
|
|
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -8218,7 +8125,7 @@ static inline void unregister_rt_sched_group(struct task_group *tg, int cpu)
|
|
}
|
|
}
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
|
|
|
|
-#ifdef CONFIG_GROUP_SCHED
|
|
|
|
|
|
+#ifdef CONFIG_CGROUP_SCHED
|
|
static void free_sched_group(struct task_group *tg)
|
|
static void free_sched_group(struct task_group *tg)
|
|
{
|
|
{
|
|
free_fair_sched_group(tg);
|
|
free_fair_sched_group(tg);
|
|
@@ -8327,7 +8234,7 @@ void sched_move_task(struct task_struct *tsk)
|
|
|
|
|
|
task_rq_unlock(rq, &flags);
|
|
task_rq_unlock(rq, &flags);
|
|
}
|
|
}
|
|
-#endif /* CONFIG_GROUP_SCHED */
|
|
|
|
|
|
+#endif /* CONFIG_CGROUP_SCHED */
|
|
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
static void __set_se_shares(struct sched_entity *se, unsigned long shares)
|
|
static void __set_se_shares(struct sched_entity *se, unsigned long shares)
|
|
@@ -8469,13 +8376,6 @@ static int tg_schedulable(struct task_group *tg, void *data)
|
|
runtime = d->rt_runtime;
|
|
runtime = d->rt_runtime;
|
|
}
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_USER_SCHED
|
|
|
|
- if (tg == &root_task_group) {
|
|
|
|
- period = global_rt_period();
|
|
|
|
- runtime = global_rt_runtime();
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Cannot have more runtime than the period.
|
|
* Cannot have more runtime than the period.
|
|
*/
|
|
*/
|