]> Git Repo - linux.git/commitdiff
cpuset: remove on stack cpumask_t in cpuset_can_attach()
authorLi Zefan <[email protected]>
Thu, 8 Jan 2009 02:08:41 +0000 (18:08 -0800)
committerLinus Torvalds <[email protected]>
Thu, 8 Jan 2009 16:31:11 +0000 (08:31 -0800)
Impact: reduce stack usage

Just use cs->cpus_allowed, and no need to allocate a cpumask_var_t.

Signed-off-by: Li Zefan <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Rusty Russell <[email protected]>
Acked-by: Mike Travis <[email protected]>
Cc: Paul Menage <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/cpuset.c

index 41c2343df97560b3c28c5974a388d7d825c11e08..afa29cfc5bbb2ab6f740dc794346c1e247244e6f 100644 (file)
@@ -1311,20 +1311,19 @@ static int cpuset_can_attach(struct cgroup_subsys *ss,
                             struct cgroup *cont, struct task_struct *tsk)
 {
        struct cpuset *cs = cgroup_cs(cont);
+       int ret = 0;
 
        if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
                return -ENOSPC;
-       if (tsk->flags & PF_THREAD_BOUND) {
-               cpumask_t mask;
 
+       if (tsk->flags & PF_THREAD_BOUND) {
                mutex_lock(&callback_mutex);
-               mask = cs->cpus_allowed;
+               if (!cpus_equal(tsk->cpus_allowed, cs->cpus_allowed))
+                       ret = -EINVAL;
                mutex_unlock(&callback_mutex);
-               if (!cpus_equal(tsk->cpus_allowed, mask))
-                       return -EINVAL;
        }
 
-       return security_task_setscheduler(tsk, 0, NULL);
+       return ret < 0 ? ret : security_task_setscheduler(tsk, 0, NULL);
 }
 
 static void cpuset_attach(struct cgroup_subsys *ss,
This page took 0.053679 seconds and 4 git commands to generate.