From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753350AbbEMGTy (ORCPT ); Wed, 13 May 2015 02:19:54 -0400 Received: from mga11.intel.com ([192.55.52.93]:49518 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254AbbEMGTO (ORCPT ); Wed, 13 May 2015 02:19:14 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,419,1427785200"; d="scan'208";a="492930294" From: Wanpeng Li To: Ingo Molnar , Peter Zijlstra Cc: Juri Lelli , linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH v2 7/7] sched/rt: reschedule if stop/dl task slip in after pull operations Date: Wed, 13 May 2015 14:01:07 +0800 Message-Id: <1431496867-4194-7-git-send-email-wanpeng.li@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431496867-4194-1-git-send-email-wanpeng.li@linux.intel.com> References: <1431496867-4194-1-git-send-email-wanpeng.li@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pull_rt_task() can drop (and re-acquire) rq->lock, this means a dl or stop task can slip in, in which case need to reschedule. This patch add the reschedule when the scenario occurs. Signed-off-by: Wanpeng Li --- kernel/sched/rt.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 560d2fa..8c948bf 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2136,7 +2136,14 @@ static void switched_from_rt(struct rq *rq, struct task_struct *p) if (!task_on_rq_queued(p) || rq->rt.rt_nr_running) return; - if (pull_rt_task(rq)) + /* + * pull_rt_task() can drop (and re-acquire) rq->lock; this + * means a dl or stop task can slip in, in which case we need + * to reschedule. + */ + if (pull_rt_task(rq) || + (unlikely((rq->stop && task_on_rq_queued(rq->stop)) || + rq->dl.dl_nr_running))) resched_curr(rq); } @@ -2197,6 +2204,16 @@ prio_changed_rt(struct rq *rq, struct task_struct *p, int oldprio) */ if (oldprio < p->prio) pull_rt_task(rq); + + /* + * pull_rt_task() can drop (and re-acquire) rq->lock; this + * means a dl or stop task can slip in, in which case we need + * to reschedule. + */ + if (unlikely((rq->stop && task_on_rq_queued(rq->stop)) || + rq->dl.dl_nr_running)) + resched_curr(rq); + /* * If there's a higher priority task waiting to run * then reschedule. Note, the above pull_rt_task -- 1.9.1