aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 1cb53fb1fe3d..9df9ba73cb7a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4268,11 +4268,10 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
4268 oldprio = p->prio; 4268 oldprio = p->prio;
4269 on_rq = p->se.on_rq; 4269 on_rq = p->se.on_rq;
4270 running = task_current(rq, p); 4270 running = task_current(rq, p);
4271 if (on_rq) { 4271 if (on_rq)
4272 dequeue_task(rq, p, 0); 4272 dequeue_task(rq, p, 0);
4273 if (running) 4273 if (running)
4274 p->sched_class->put_prev_task(rq, p); 4274 p->sched_class->put_prev_task(rq, p);
4275 }
4276 4275
4277 if (rt_prio(prio)) 4276 if (rt_prio(prio))
4278 p->sched_class = &rt_sched_class; 4277 p->sched_class = &rt_sched_class;
@@ -4281,10 +4280,9 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
4281 4280
4282 p->prio = prio; 4281 p->prio = prio;
4283 4282
4283 if (running)
4284 p->sched_class->set_curr_task(rq);
4284 if (on_rq) { 4285 if (on_rq) {
4285 if (running)
4286 p->sched_class->set_curr_task(rq);
4287
4288 enqueue_task(rq, p, 0); 4286 enqueue_task(rq, p, 0);
4289 4287
4290 check_class_changed(rq, p, prev_class, oldprio, running); 4288 check_class_changed(rq, p, prev_class, oldprio, running);
@@ -4581,19 +4579,17 @@ recheck:
4581 update_rq_clock(rq); 4579 update_rq_clock(rq);
4582 on_rq = p->se.on_rq; 4580 on_rq = p->se.on_rq;
4583 running = task_current(rq, p); 4581 running = task_current(rq, p);
4584 if (on_rq) { 4582 if (on_rq)
4585 deactivate_task(rq, p, 0); 4583 deactivate_task(rq, p, 0);
4586 if (running) 4584 if (running)
4587 p->sched_class->put_prev_task(rq, p); 4585 p->sched_class->put_prev_task(rq, p);
4588 }
4589 4586
4590 oldprio = p->prio; 4587 oldprio = p->prio;
4591 __setscheduler(rq, p, policy, param->sched_priority); 4588 __setscheduler(rq, p, policy, param->sched_priority);
4592 4589
4590 if (running)
4591 p->sched_class->set_curr_task(rq);
4593 if (on_rq) { 4592 if (on_rq) {
4594 if (running)
4595 p->sched_class->set_curr_task(rq);
4596
4597 activate_task(rq, p, 0); 4593 activate_task(rq, p, 0);
4598 4594
4599 check_class_changed(rq, p, prev_class, oldprio, running); 4595 check_class_changed(rq, p, prev_class, oldprio, running);
@@ -7618,11 +7614,10 @@ void sched_move_task(struct task_struct *tsk)
7618 running = task_current(rq, tsk); 7614 running = task_current(rq, tsk);
7619 on_rq = tsk->se.on_rq; 7615 on_rq = tsk->se.on_rq;
7620 7616
7621 if (on_rq) { 7617 if (on_rq)
7622 dequeue_task(rq, tsk, 0); 7618 dequeue_task(rq, tsk, 0);
7623 if (unlikely(running)) 7619 if (unlikely(running))
7624 tsk->sched_class->put_prev_task(rq, tsk); 7620 tsk->sched_class->put_prev_task(rq, tsk);
7625 }
7626 7621
7627 set_task_rq(tsk, task_cpu(tsk)); 7622 set_task_rq(tsk, task_cpu(tsk));
7628 7623
@@ -7631,11 +7626,10 @@ void sched_move_task(struct task_struct *tsk)
7631 tsk->sched_class->moved_group(tsk); 7626 tsk->sched_class->moved_group(tsk);
7632#endif 7627#endif
7633 7628
7634 if (on_rq) { 7629 if (unlikely(running))
7635 if (unlikely(running)) 7630 tsk->sched_class->set_curr_task(rq);
7636 tsk->sched_class->set_curr_task(rq); 7631 if (on_rq)
7637 enqueue_task(rq, tsk, 0); 7632 enqueue_task(rq, tsk, 0);
7638 }
7639 7633
7640 task_rq_unlock(rq, &flags); 7634 task_rq_unlock(rq, &flags);
7641} 7635}