From 998e08f4c327d3687326e31983133dbd57affce9 Mon Sep 17 00:00:00 2001 From: Gregory Haskins Date: Fri, 25 Jan 2008 21:08:10 +0100 Subject: [PATCH] --- yaml --- r: 76135 b: refs/heads/master c: 318e0893ce3f524ca045f9fd9dfd567c0a6f9446 h: refs/heads/master i: 76133: 5e467c3f3ee0e06cc60e2e3a796f50dab1951bd3 76131: ab3c308c14d14d5936ba7ad9606664bc68dc65c7 76127: 5c3c2722eb0e690d0fad95313037b5d3dc318f35 v: v3 --- [refs] | 2 +- trunk/kernel/sched_rt.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ef48b4e3e5db..2c2669030d35 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2de0b4639f4b1b6bfe31f795e5855f041f177170 +refs/heads/master: 318e0893ce3f524ca045f9fd9dfd567c0a6f9446 diff --git a/trunk/kernel/sched_rt.c b/trunk/kernel/sched_rt.c index 95f36f61ae1d..ac7d06786454 100644 --- a/trunk/kernel/sched_rt.c +++ b/trunk/kernel/sched_rt.c @@ -151,8 +151,27 @@ yield_task_rt(struct rq *rq) } #ifdef CONFIG_SMP +static int find_lowest_rq(struct task_struct *task); + static int select_task_rq_rt(struct task_struct *p, int sync) { + struct rq *rq = task_rq(p); + + /* + * If the task will not preempt the RQ, try to find a better RQ + * before we even activate the task + */ + if ((p->prio >= rq->rt.highest_prio) + && (p->nr_cpus_allowed > 1)) { + int cpu = find_lowest_rq(p); + + return (cpu == -1) ? task_cpu(p) : cpu; + } + + /* + * Otherwise, just let it ride on the affined RQ and the + * post-schedule router will push the preempted task away + */ return task_cpu(p); } #endif /* CONFIG_SMP */