From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755113Ab2LLTj1 (ORCPT ); Wed, 12 Dec 2012 14:39:27 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:2761 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754813Ab2LLTjW (ORCPT ); Wed, 12 Dec 2012 14:39:22 -0500 X-Authority-Analysis: v=2.0 cv=YruNtvkX c=1 sm=0 a=rXTBtCOcEpjy1lPqhTCpEQ==:17 a=mNMOxpOpBa8A:10 a=Ciwy3NGCPMMA:10 a=jJ7Cow1ZuacA:10 a=5SG0PmZfjMsA:10 a=bbbx4UPp9XUA:10 a=meVymXHHAAAA:8 a=VNbI9rDQBQUA:10 a=-wnBujlOT7k6EHvpfdEA:9 a=jeBq3FmKZ4MA:10 a=rXTBtCOcEpjy1lPqhTCpEQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 74.67.115.198 Message-Id: <20121212193920.366926749@goodmis.org> User-Agent: quilt/0.60-1 Date: Wed, 12 Dec 2012 14:27:34 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , John Kacur , Peter Zijlstra , Clark Williams , Ingo Molnar , Frank Rowand , Mike Galbraith Subject: [RFC][PATCH RT 1/4 v2] sched/rt: Fix push_rt_task() to have the same checks as the caller did References: <20121212192733.221810086@goodmis.org> Content-Disposition: inline; filename=fix-push-rt-task-check.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the push_rt_task() only pushes the task if it is lower priority than the currently running task. But this is not the only check. If the currently running task is also pinned, we may want to push as well, and we do this check when we wake up a task, but then we are guaranteed to fail pushing the task because the internal checks may fail. Make the check the same as the wakeup checks. We could remove the check in the wake up and just let the push_rt_task() do the work, but this makes the wake up exit this check on the likely case that "ok_to_push_task()" will fail, and that we don't need to do the iterative loop of checks on the pushable task list. Signed-off-by: Steven Rostedt Index: linux-rt.git/kernel/sched/rt.c =================================================================== --- linux-rt.git.orig/kernel/sched/rt.c +++ linux-rt.git/kernel/sched/rt.c @@ -1615,6 +1615,15 @@ static struct task_struct *pick_next_pus return p; } +static int ok_to_push_task(struct task_struct *p, struct task_struct *curr) +{ + return p->nr_cpus_allowed > 1 && + rt_task(curr) && + (curr->migrate_disable || + curr->nr_cpus_allowed < 2 || + curr->prio <= p->prio); +} + /* * If the current CPU has more than one RT task, see if the non * running task can migrate over to a CPU that is running a task @@ -1649,7 +1658,7 @@ retry: * higher priority than current. If that's the case * just reschedule current. */ - if (unlikely(next_task->prio < rq->curr->prio)) { + if (!ok_to_push_task(next_task, rq->curr)) { resched_task(rq->curr); return 0; } @@ -1814,10 +1823,7 @@ static void task_woken_rt(struct rq *rq, if (!task_running(rq, p) && !test_tsk_need_resched(rq->curr) && has_pushable_tasks(rq) && - p->nr_cpus_allowed > 1 && - rt_task(rq->curr) && - (rq->curr->nr_cpus_allowed < 2 || - rq->curr->prio <= p->prio)) + ok_to_push_task(p, rq->curr)) push_rt_tasks(rq); }