lkml.org 
[lkml]   [2011]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] sched: check and preempt the current task at right place
From
When switching a task to RT, it is the right place to preempt the current
running task if the task is not running. Same scenario also rises when the
priority of task has changed.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
kernel/sched_rt.c | 19 +++----------------
1 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 88725c9..4a9553e 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1671,25 +1671,13 @@ static inline void init_sched_rt_class(void)
*/
static void switched_to_rt(struct rq *rq, struct task_struct *p)
{
- int check_resched = 1;
-
/*
* If we are already running, then there's nothing
* that needs to be done. But if we are not running
* we may need to preempt the current running task.
- * If that current running task is also an RT task
- * then see if we can move to another run queue.
*/
- if (p->on_rq && rq->curr != p) {
-#ifdef CONFIG_SMP
- if (rq->rt.overloaded && push_rt_task(rq) &&
- /* Don't resched if we changed runqueues */
- rq != task_rq(p))
- check_resched = 0;
-#endif /* CONFIG_SMP */
- if (check_resched && p->prio < rq->curr->prio)
- resched_task(rq->curr);
- }
+ if (p->on_rq && rq->curr != p)
+ check_preempt_curr_rt(rq, p, 0);
}

/*
@@ -1729,8 +1717,7 @@ prio_changed_rt(struct rq *rq, struct
task_struct *p, int oldprio)
* greater than the current running task
* then reschedule.
*/
- if (p->prio < rq->curr->prio)
- resched_task(rq->curr);
+ check_preempt_curr_rt(rq, p, 0);
}
}

\
 
 \ /
  Last update: 2011-05-31 15:07    [W:0.042 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site