|
@@ -1429,15 +1429,16 @@ static int fmeter_getrate(struct fmeter *fmp)
|
|
static struct cpuset *cpuset_attach_old_cs;
|
|
static struct cpuset *cpuset_attach_old_cs;
|
|
|
|
|
|
/* Called by cgroups to determine if a cpuset is usable; cpuset_mutex held */
|
|
/* Called by cgroups to determine if a cpuset is usable; cpuset_mutex held */
|
|
-static int cpuset_can_attach(struct cgroup_subsys_state *css,
|
|
|
|
- struct cgroup_taskset *tset)
|
|
|
|
|
|
+static int cpuset_can_attach(struct cgroup_taskset *tset)
|
|
{
|
|
{
|
|
- struct cpuset *cs = css_cs(css);
|
|
|
|
|
|
+ struct cgroup_subsys_state *css;
|
|
|
|
+ struct cpuset *cs;
|
|
struct task_struct *task;
|
|
struct task_struct *task;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
/* used later by cpuset_attach() */
|
|
/* used later by cpuset_attach() */
|
|
- cpuset_attach_old_cs = task_cs(cgroup_taskset_first(tset));
|
|
|
|
|
|
+ cpuset_attach_old_cs = task_cs(cgroup_taskset_first(tset, &css));
|
|
|
|
+ cs = css_cs(css);
|
|
|
|
|
|
mutex_lock(&cpuset_mutex);
|
|
mutex_lock(&cpuset_mutex);
|
|
|
|
|
|
@@ -1447,7 +1448,7 @@ static int cpuset_can_attach(struct cgroup_subsys_state *css,
|
|
(cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)))
|
|
(cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)))
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
|
|
|
|
- cgroup_taskset_for_each(task, tset) {
|
|
|
|
|
|
+ cgroup_taskset_for_each(task, css, tset) {
|
|
ret = task_can_attach(task, cs->cpus_allowed);
|
|
ret = task_can_attach(task, cs->cpus_allowed);
|
|
if (ret)
|
|
if (ret)
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
@@ -1467,9 +1468,14 @@ out_unlock:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static void cpuset_cancel_attach(struct cgroup_subsys_state *css,
|
|
|
|
- struct cgroup_taskset *tset)
|
|
|
|
|
|
+static void cpuset_cancel_attach(struct cgroup_taskset *tset)
|
|
{
|
|
{
|
|
|
|
+ struct cgroup_subsys_state *css;
|
|
|
|
+ struct cpuset *cs;
|
|
|
|
+
|
|
|
|
+ cgroup_taskset_first(tset, &css);
|
|
|
|
+ cs = css_cs(css);
|
|
|
|
+
|
|
mutex_lock(&cpuset_mutex);
|
|
mutex_lock(&cpuset_mutex);
|
|
css_cs(css)->attach_in_progress--;
|
|
css_cs(css)->attach_in_progress--;
|
|
mutex_unlock(&cpuset_mutex);
|
|
mutex_unlock(&cpuset_mutex);
|
|
@@ -1482,16 +1488,19 @@ static void cpuset_cancel_attach(struct cgroup_subsys_state *css,
|
|
*/
|
|
*/
|
|
static cpumask_var_t cpus_attach;
|
|
static cpumask_var_t cpus_attach;
|
|
|
|
|
|
-static void cpuset_attach(struct cgroup_subsys_state *css,
|
|
|
|
- struct cgroup_taskset *tset)
|
|
|
|
|
|
+static void cpuset_attach(struct cgroup_taskset *tset)
|
|
{
|
|
{
|
|
/* static buf protected by cpuset_mutex */
|
|
/* static buf protected by cpuset_mutex */
|
|
static nodemask_t cpuset_attach_nodemask_to;
|
|
static nodemask_t cpuset_attach_nodemask_to;
|
|
struct task_struct *task;
|
|
struct task_struct *task;
|
|
struct task_struct *leader;
|
|
struct task_struct *leader;
|
|
- struct cpuset *cs = css_cs(css);
|
|
|
|
|
|
+ struct cgroup_subsys_state *css;
|
|
|
|
+ struct cpuset *cs;
|
|
struct cpuset *oldcs = cpuset_attach_old_cs;
|
|
struct cpuset *oldcs = cpuset_attach_old_cs;
|
|
|
|
|
|
|
|
+ cgroup_taskset_first(tset, &css);
|
|
|
|
+ cs = css_cs(css);
|
|
|
|
+
|
|
mutex_lock(&cpuset_mutex);
|
|
mutex_lock(&cpuset_mutex);
|
|
|
|
|
|
/* prepare for attach */
|
|
/* prepare for attach */
|
|
@@ -1502,7 +1511,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css,
|
|
|
|
|
|
guarantee_online_mems(cs, &cpuset_attach_nodemask_to);
|
|
guarantee_online_mems(cs, &cpuset_attach_nodemask_to);
|
|
|
|
|
|
- cgroup_taskset_for_each(task, tset) {
|
|
|
|
|
|
+ cgroup_taskset_for_each(task, css, tset) {
|
|
/*
|
|
/*
|
|
* can_attach beforehand should guarantee that this doesn't
|
|
* can_attach beforehand should guarantee that this doesn't
|
|
* fail. TODO: have a better way to handle failure here
|
|
* fail. TODO: have a better way to handle failure here
|
|
@@ -1518,7 +1527,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css,
|
|
* sleep and should be moved outside migration path proper.
|
|
* sleep and should be moved outside migration path proper.
|
|
*/
|
|
*/
|
|
cpuset_attach_nodemask_to = cs->effective_mems;
|
|
cpuset_attach_nodemask_to = cs->effective_mems;
|
|
- cgroup_taskset_for_each_leader(leader, tset) {
|
|
|
|
|
|
+ cgroup_taskset_for_each_leader(leader, css, tset) {
|
|
struct mm_struct *mm = get_task_mm(leader);
|
|
struct mm_struct *mm = get_task_mm(leader);
|
|
|
|
|
|
if (mm) {
|
|
if (mm) {
|