diff options
author | Yong Zhang <yong.zhang0@gmail.com> | 2011-05-09 16:07:05 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-16 11:01:18 +0200 |
commit | db44fc017d5989302713ab4e7f9e922b648f4b59 (patch) | |
tree | a6b8830b580fe5ebf7b0ff2f271c59173b15bc9b /kernel/sched.c | |
parent | sched, rt: Update rq clock when unthrottling of an otherwise idle CPU (diff) | |
download | linux-db44fc017d5989302713ab4e7f9e922b648f4b59.tar.xz linux-db44fc017d5989302713ab4e7f9e922b648f4b59.zip |
sched: Avoid going ahead if ->cpus_allowed is not changed
If cpumask_equal(&p->cpus_allowed, new_mask) is true, seems
there is no reason to prevent set_cpus_allowed_ptr() return
directly.
Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Acked-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20110509140705.GA2219@zhy
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index b8b9a7dac9b0..70bec4f1edbb 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -5946,13 +5946,15 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) rq = task_rq_lock(p, &flags); + if (cpumask_equal(&p->cpus_allowed, new_mask)) + goto out; + if (!cpumask_intersects(new_mask, cpu_active_mask)) { ret = -EINVAL; goto out; } - if (unlikely((p->flags & PF_THREAD_BOUND) && p != current && - !cpumask_equal(&p->cpus_allowed, new_mask))) { + if (unlikely((p->flags & PF_THREAD_BOUND) && p != current)) { ret = -EINVAL; goto out; } |