sched/rt: Optimize select_task_rq_rt() for non-RT curr task
Hillf Danton
NAKQuoted 28 lines
When selecting the cpu for a waking RT task, if curr is a non-RT task which is bound only on this cpu, then we can give it a chance to select a different cpu(definitely an idle cpu if existing) for the RT task to avoid curr starving.
Signed-off-by pang.xunlei <[email protected]>--- kernel/sched/rt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)kernel/sched/rt.c +5
-0@@ -1340,6 +1340,11 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)* runqueue. Otherwise simply start this RT task * on its current runqueue. * +* If the current task on @p's runqueue is a non-RT task, +* and this task is bound on current runqueue, then try to +* see if we can wake this RT task up on a different runqueue, +* we will definitely find an idle cpu if there is any. +* * We want to avoid overloading runqueues. If the woken * task is a higher priority, then it will stay on this CPU * and the lower prio task should be moved to another CPU.
kernel/sched/rt.c select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags) · line 1365
Quoted 8 lines
kernel/sched/rt.c +2
-3@@ -1356,9 +1361,8 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)* This test is optimistic, if we get it wrong the load-balancer * will have to sort it out. */ -if (curr &&unlikely (rt_task (curr)) && - (curr->nr_cpus_allowed <2 || - curr->prio <= p->prio)) { +if (curr &&unlikely (curr->nr_cpus_allowed <2 || + curr->prio <= p->prio)) {
Nack, it is no meaning to compare apple against orange.
Hillf
Quoted 5 lines
kernel/sched/rt.c +0
-1int target =find_lowest_rq (p);if (target !=-1 ) --1.7.9.5