Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69044
b: refs/heads/master
c: 7074bad
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Adamushko authored and Ingo Molnar committed Oct 15, 2007
1 parent 410240c commit 3ef4cb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d02e5ed8d55e2a2b2735232ea1da40ffbf4c0932
refs/heads/master: 7074badbcb4212d404a243e5c50efeb778ec3fc6
22 changes: 13 additions & 9 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3915,8 +3915,8 @@ EXPORT_SYMBOL(sleep_on_timeout);
*/
void rt_mutex_setprio(struct task_struct *p, int prio)
{
int oldprio, on_rq, running;
unsigned long flags;
int oldprio, on_rq;
struct rq *rq;

BUG_ON(prio < 0 || prio > MAX_PRIO);
Expand All @@ -3926,9 +3926,10 @@ void rt_mutex_setprio(struct task_struct *p, int prio)

oldprio = p->prio;
on_rq = p->se.on_rq;
running = task_running(rq, p);
if (on_rq) {
dequeue_task(rq, p, 0);
if (task_running(rq, p))
if (running)
p->sched_class->put_prev_task(rq, p);
}

Expand All @@ -3940,16 +3941,17 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
p->prio = prio;

if (on_rq) {
if (running)
p->sched_class->set_curr_task(rq);
enqueue_task(rq, p, 0);
/*
* Reschedule if we are currently running on this runqueue and
* our priority decreased, or if we are not currently running on
* this runqueue and our priority is higher than the current's
*/
if (task_running(rq, p)) {
if (running) {
if (p->prio > oldprio)
resched_task(rq->curr);
p->sched_class->set_curr_task(rq);
} else {
check_preempt_curr(rq, p);
}
Expand Down Expand Up @@ -4153,7 +4155,7 @@ __setscheduler(struct rq *rq, struct task_struct *p, int policy, int prio)
int sched_setscheduler(struct task_struct *p, int policy,
struct sched_param *param)
{
int retval, oldprio, oldpolicy = -1, on_rq;
int retval, oldprio, oldpolicy = -1, on_rq, running;
unsigned long flags;
struct rq *rq;

Expand Down Expand Up @@ -4235,24 +4237,26 @@ int sched_setscheduler(struct task_struct *p, int policy,
}
update_rq_clock(rq);
on_rq = p->se.on_rq;
running = task_running(rq, p);
if (on_rq) {
deactivate_task(rq, p, 0);
if (task_running(rq, p))
if (running)
p->sched_class->put_prev_task(rq, p);
}
oldprio = p->prio;
__setscheduler(rq, p, policy, param->sched_priority);
if (on_rq) {
if (running)
p->sched_class->set_curr_task(rq);
activate_task(rq, p, 0);
/*
* Reschedule if we are currently running on this runqueue and
* our priority decreased, or if we are not currently running on
* this runqueue and our priority is higher than the current's
*/
if (task_running(rq, p)) {
if (running) {
if (p->prio > oldprio)
resched_task(rq->curr);
p->sched_class->set_curr_task(rq);
} else {
check_preempt_curr(rq, p);
}
Expand Down Expand Up @@ -6861,9 +6865,9 @@ static void sched_move_task(struct container_subsys *ss, struct container *cont,
set_task_cfs_rq(tsk);

if (on_rq) {
enqueue_task(rq, tsk, 0);
if (unlikely(running))
tsk->sched_class->set_curr_task(rq);
enqueue_task(rq, tsk, 0);
}

done:
Expand Down

0 comments on commit 3ef4cb8

Please sign in to comment.