From: tip-bot for Yong Zhang <yong.zhang0@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
dhillf@gmail.com, a.p.zijlstra@chello.nl, yong.zhang0@gmail.com,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:sched/core] sched: Avoid going ahead if ->cpus_allowed is not changed
Date: Mon, 16 May 2011 10:37:53 GMT [thread overview]
Message-ID: <tip-db44fc017d5989302713ab4e7f9e922b648f4b59@git.kernel.org> (raw)
In-Reply-To: <20110509140705.GA2219@zhy>
Commit-ID: db44fc017d5989302713ab4e7f9e922b648f4b59
Gitweb: http://git.kernel.org/tip/db44fc017d5989302713ab4e7f9e922b648f4b59
Author: Yong Zhang <yong.zhang0@gmail.com>
AuthorDate: Mon, 9 May 2011 22:07:05 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 16 May 2011 11:01:18 +0200
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>
---
kernel/sched.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index b8b9a7d..70bec4f 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;
}
prev parent reply other threads:[~2011-05-16 10:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 12:52 [PATCH] sched: shorten setting the allowed cpu mask of task Hillf Danton
2011-05-09 4:39 ` Yong Zhang
2011-05-09 12:52 ` Hillf Danton
2011-05-09 14:07 ` Yong Zhang
2011-05-10 12:38 ` Hillf Danton
2011-05-16 10:37 ` tip-bot for Yong Zhang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-db44fc017d5989302713ab4e7f9e922b648f4b59@git.kernel.org \
--to=yong.zhang0@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=dhillf@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox