summaryrefslogtreecommitdiffstats
path: root/kernel/sched/rt.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2015-05-15 17:43:35 +0200
committerIngo Molnar <mingo@kernel.org>2015-08-12 12:06:09 +0200
commitc5b2803840817115e9b568d5054e5007ae36176b (patch)
treecf95c50a52bf6e99c9c7eaff63534b535d7ba0c2 /kernel/sched/rt.c
parentsched: Fix a race between __kthread_bind() and sched_setaffinity() (diff)
downloadlinux-c5b2803840817115e9b568d5054e5007ae36176b.tar.xz
linux-c5b2803840817115e9b568d5054e5007ae36176b.zip
sched: Make sched_class::set_cpus_allowed() unconditional
Give every class a set_cpus_allowed() method, this enables some small optimization in the RT,DL implementation by avoiding a double cpumask_weight() call. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: dedekind1@gmail.com Cc: juri.lelli@arm.com Cc: mgorman@suse.de Cc: riel@redhat.com Cc: rostedt@goodmis.org Link: http://lkml.kernel.org/r/20150515154833.614517487@infradead.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/rt.c')
-rw-r--r--kernel/sched/rt.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 00816eeaa308..63692efeca82 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2084,9 +2084,6 @@ static void set_cpus_allowed_rt(struct task_struct *p,
BUG_ON(!rt_task(p));
- if (!task_on_rq_queued(p))
- return;
-
weight = cpumask_weight(new_mask);
/*
@@ -2094,7 +2091,10 @@ static void set_cpus_allowed_rt(struct task_struct *p,
* can migrate or not.
*/
if ((p->nr_cpus_allowed > 1) == (weight > 1))
- return;
+ goto done;
+
+ if (!task_on_rq_queued(p))
+ goto done;
rq = task_rq(p);
@@ -2113,6 +2113,10 @@ static void set_cpus_allowed_rt(struct task_struct *p,
}
update_rt_migration(&rq->rt);
+
+done:
+ cpumask_copy(&p->cpus_allowed, new_mask);
+ p->nr_cpus_allowed = weight;
}
/* Assumes rq->lock is held */