Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754719AbaA1HRu (ORCPT ); Tue, 28 Jan 2014 02:17:50 -0500 Received: from relay.parallels.com ([195.214.232.42]:46873 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752092AbaA1HRt (ORCPT ); Tue, 28 Jan 2014 02:17:49 -0500 Subject: [PATCH -tip] sched/deadline: switched_to_dl() -- skip if task is current To: From: Kirill Tkhai CC: , , , Date: Tue, 28 Jan 2014 11:18:02 +0400 Message-ID: <20140128071649.32113.73501.stgit@tkhai> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.30.26.172] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When p is current and it's not of dl class, then there are no other dl taks in the rq. If we had had pushable tasks in some other rq, they would have been pushed earlier. So, skip "p == rq->curr" case. This helps to skip excess schedule() when class is changed. The situation may be not rare. For example: a small number of deadline tasks which have common rt_spinlocks with fair tasks. Priority inheritance mechanism does this every time it is acquiring a lock. [This is confirmed by Juri Lelli and LKML was CC'ed, but unfotunately I can't find direct link on lkml.org] Signed-off-by: Kirill Tkhai CC: Juri Lelli CC: Peter Zijlstra CC: Ingo Molnar --- kernel/sched/deadline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 0de2482..dd19d6d 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1559,7 +1559,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) if (unlikely(p->dl.dl_throttled)) return; - if (p->on_rq || rq->curr != p) { + if (p->on_rq && rq->curr != p) { #ifdef CONFIG_SMP if (rq->dl.overloaded && push_dl_task(rq) && rq != task_rq(p)) /* Only reschedule if pushing failed */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/