Merge branch 'tip/sched/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into sched/core
Pull a scheduler optimization commit from Steven Rostedt. Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
4cbb62148c
|
@ -1803,44 +1803,40 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p)
|
||||||
static void set_cpus_allowed_rt(struct task_struct *p,
|
static void set_cpus_allowed_rt(struct task_struct *p,
|
||||||
const struct cpumask *new_mask)
|
const struct cpumask *new_mask)
|
||||||
{
|
{
|
||||||
int weight = cpumask_weight(new_mask);
|
struct rq *rq;
|
||||||
|
int weight;
|
||||||
|
|
||||||
BUG_ON(!rt_task(p));
|
BUG_ON(!rt_task(p));
|
||||||
|
|
||||||
|
if (!p->on_rq)
|
||||||
|
return;
|
||||||
|
|
||||||
|
weight = cpumask_weight(new_mask);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the migration status of the RQ if we have an RT task
|
* Only update if the process changes its state from whether it
|
||||||
* which is running AND changing its weight value.
|
* can migrate or not.
|
||||||
*/
|
*/
|
||||||
if (p->on_rq && (weight != p->rt.nr_cpus_allowed)) {
|
if ((p->rt.nr_cpus_allowed > 1) == (weight > 1))
|
||||||
struct rq *rq = task_rq(p);
|
return;
|
||||||
|
|
||||||
if (!task_current(rq, p)) {
|
rq = task_rq(p);
|
||||||
/*
|
|
||||||
* Make sure we dequeue this task from the pushable list
|
|
||||||
* before going further. It will either remain off of
|
|
||||||
* the list because we are no longer pushable, or it
|
|
||||||
* will be requeued.
|
|
||||||
*/
|
|
||||||
if (p->rt.nr_cpus_allowed > 1)
|
|
||||||
dequeue_pushable_task(rq, p);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Requeue if our weight is changing and still > 1
|
* The process used to be able to migrate OR it can now migrate
|
||||||
*/
|
*/
|
||||||
if (weight > 1)
|
if (weight <= 1) {
|
||||||
enqueue_pushable_task(rq, p);
|
if (!task_current(rq, p))
|
||||||
|
dequeue_pushable_task(rq, p);
|
||||||
}
|
BUG_ON(!rq->rt.rt_nr_migratory);
|
||||||
|
rq->rt.rt_nr_migratory--;
|
||||||
if ((p->rt.nr_cpus_allowed <= 1) && (weight > 1)) {
|
} else {
|
||||||
rq->rt.rt_nr_migratory++;
|
if (!task_current(rq, p))
|
||||||
} else if ((p->rt.nr_cpus_allowed > 1) && (weight <= 1)) {
|
enqueue_pushable_task(rq, p);
|
||||||
BUG_ON(!rq->rt.rt_nr_migratory);
|
rq->rt.rt_nr_migratory++;
|
||||||
rq->rt.rt_nr_migratory--;
|
|
||||||
}
|
|
||||||
|
|
||||||
update_rt_migration(&rq->rt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_rt_migration(&rq->rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assumes rq->lock is held */
|
/* Assumes rq->lock is held */
|
||||||
|
|
Loading…
Reference in New Issue