Skip to contentSkip to conversation

sched/rt: Remove redundant nr_cpus_allowed test

PATCH In review Shawn Bohrer 3 participants 3 messages Oct 4, 2013 – Oct 6, 2013 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/rt: Remove redundant nr_cpus_allowed test

From: Shawn Bohrer <[email protected]>

In 76854c7e8f3f4172fef091e78d88b3b751463ac6 "sched: Use rt.nr_cpus_allowed to recover select_task_rq() cycles" an optimization was added to select_task_rq_rt() that immediately returns when p->nr_cpus_allowed == 1 at the beginning of the function. This makes the latter p->nr_cpus_allowed > 1 check redundant and can be removed.

---
 kernel/sched/rt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/rt.c +1 -2
index 01970c8..ceebfba 100644
@@ -1213,8 +1213,7 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
 	 */
 	if (curr && unlikely(rt_task(curr)) &&
 	    (curr->nr_cpus_allowed < 2 ||
-	     curr->prio <= p->prio) &&
-	    (p->nr_cpus_allowed > 1)) {
+	     curr->prio <= p->prio)) {
 		int target = find_lowest_rq(p);
 
 		if (target != -1)
Signature · 1 line
1.8.1.4
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Fri, 4 Oct 2013 14:24:53 -0500 Shawn Bohrer <[email protected]> wrote:

From: Shawn Bohrer <[email protected]>

In 76854c7e8f3f4172fef091e78d88b3b751463ac6 "sched: Use rt.nr_cpus_allowed to recover select_task_rq() cycles" an optimization was added to select_task_rq_rt() that immediately returns when p->nr_cpus_allowed == 1 at the beginning of the function. This makes the latter p->nr_cpus_allowed > 1 check redundant and can be removed.

-- Steve

Quoted 18 lines
---
 kernel/sched/rt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/rt.c +1 -2
index 01970c8..ceebfba 100644
@@ -1213,8 +1213,7 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
 	 */
 	if (curr && unlikely(rt_task(curr)) &&
 	    (curr->nr_cpus_allowed < 2 ||
-	     curr->prio <= p->prio) &&
-	    (p->nr_cpus_allowed > 1)) {
+	     curr->prio <= p->prio)) {
 		int target = find_lowest_rq(p);
 
 		if (target != -1)
#2 lore raw
In reply to Shawn Bohrer
sched/rt: Remove redundant nr_cpus_allowed test
Commit-ID:  6bfa687c19b7ab8adee03f0d43c197c2945dd869
Gitweb:     http://git.kernel.org/tip/6bfa687c19b7ab8adee03f0d43c197c2945dd869
Author:     Shawn Bohrer <[email protected]>
AuthorDate: Fri, 4 Oct 2013 14:24:53 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 6 Oct 2013 11:28:40 +0200

sched/rt: Remove redundant nr_cpus_allowed test

In 76854c7e8f3f4172fef091e78d88b3b751463ac6 ("sched: Use rt.nr_cpus_allowed to recover select_task_rq() cycles") an optimization was added to select_task_rq_rt() that immediately returns when p->nr_cpus_allowed == 1 at the beginning of the function.

This makes the latter p->nr_cpus_allowed > 1 check redundant, which can now be removed.

---
 kernel/sched/rt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/rt.c +1 -2
index 01970c8..ceebfba 100644
@@ -1213,8 +1213,7 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
 	 */
 	if (curr && unlikely(rt_task(curr)) &&
 	    (curr->nr_cpus_allowed < 2 ||
-	     curr->prio <= p->prio) &&
-	    (p->nr_cpus_allowed > 1)) {
+	     curr->prio <= p->prio)) {
 		int target = find_lowest_rq(p);
 
 		if (target != -1)