From 7c12352decbefc212d56a633906dce5936ef94bb Mon Sep 17 00:00:00 2001 From: Stefan Guendhoer Date: Thu, 7 Jan 2016 22:12:48 +0000 Subject: sched/rt: Reduce rq lock contention by eliminating locking of non-feasible target --- kernel/sched/rt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'kernel/sched') diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index fb7892646..692fb1e77 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2290,6 +2290,16 @@ static struct rq *find_lock_lowest_rq_mtk(struct task_struct *task, struct rq *r lowest_rq = cpu_rq(cpu); + if (lowest_rq->rt.highest_prio.curr <= task->prio) { + /* + * Target rq has tasks of equal or higher priority, + * retrying does not release any lock and is unlikely + * to yield a different result. + */ + lowest_rq = NULL; + break; + } + /* if the prio of this runqueue changed, try again */ if (double_lock_balance(rq, lowest_rq)) { /* -- cgit v1.2.3