]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/cpuset.c
port_fixups: Fix ups for tty port changes
[linux-2.6-omap-h63xx.git] / kernel / cpuset.c
index 798b3ab054ebda48f9dd758ba7d080b3ab51bd28..d2cc67dac8b1445b47fad8ebf120fafba62ccfdc 100644 (file)
@@ -679,7 +679,9 @@ restart:
                                if (apn == b->pn) {
                                        cpus_or(*dp, *dp, b->cpus_allowed);
                                        b->pn = -1;
-                                       update_domain_attr(dattr, b);
+                                       if (dattr)
+                                               update_domain_attr(dattr
+                                                                  + nslot, b);
                                }
                        }
                        nslot++;
@@ -1194,6 +1196,15 @@ static int cpuset_can_attach(struct cgroup_subsys *ss,
 
        if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
                return -ENOSPC;
+       if (tsk->flags & PF_THREAD_BOUND) {
+               cpumask_t mask;
+
+               mutex_lock(&callback_mutex);
+               mask = cs->cpus_allowed;
+               mutex_unlock(&callback_mutex);
+               if (!cpus_equal(tsk->cpus_allowed, mask))
+                       return -EINVAL;
+       }
 
        return security_task_setscheduler(tsk, 0, NULL);
 }
@@ -1207,11 +1218,14 @@ static void cpuset_attach(struct cgroup_subsys *ss,
        struct mm_struct *mm;
        struct cpuset *cs = cgroup_cs(cont);
        struct cpuset *oldcs = cgroup_cs(oldcont);
+       int err;
 
        mutex_lock(&callback_mutex);
        guarantee_online_cpus(cs, &cpus);
-       set_cpus_allowed_ptr(tsk, &cpus);
+       err = set_cpus_allowed_ptr(tsk, &cpus);
        mutex_unlock(&callback_mutex);
+       if (err)
+               return;
 
        from = oldcs->mems_allowed;
        to = cs->mems_allowed;