From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932345AbdELDbV (ORCPT ); Thu, 11 May 2017 23:31:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756413AbdELDbS (ORCPT ); Thu, 11 May 2017 23:31:18 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B73CC8048A Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=xlpang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B73CC8048A From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Juri Lelli , Ingo Molnar , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Xunlei Pang , Luca Abeni Subject: [PATCH v2 2/3] sched/deadline: Throttle the task when missing its deadline Date: Fri, 12 May 2017 11:32:08 +0800 Message-Id: <1494559929-11462-2-git-send-email-xlpang@redhat.com> In-Reply-To: <1494559929-11462-1-git-send-email-xlpang@redhat.com> References: <1494559929-11462-1-git-send-email-xlpang@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 12 May 2017 03:31:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dl_runtime_exceeded() only checks negative runtime, actually when the current deadline past, we should start a new period and zero out the remaining runtime as well. This patch improves dl_runtime_exceeded() to achieve that. Fixes: 269ad8015a6b ("sched/deadline: Avoid double-accounting in case of missed deadlines") Cc: Luca Abeni Signed-off-by: Xunlei Pang --- kernel/sched/deadline.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index d3d291e..5691149 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -729,8 +729,13 @@ static inline void dl_check_constrained_dl(struct sched_dl_entity *dl_se) } static -int dl_runtime_exceeded(struct sched_dl_entity *dl_se) +int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se) { + bool dmiss = dl_time_before(dl_se->deadline, rq_clock(rq)); + + if (dmiss && dl_se->runtime > 0) + dl_se->runtime = 0; + return (dl_se->runtime <= 0); } @@ -781,7 +786,7 @@ static void update_curr_dl(struct rq *rq) dl_se->runtime -= delta_exec; throttle: - if (dl_runtime_exceeded(dl_se) || dl_se->dl_yielded) { + if (dl_runtime_exceeded(rq, dl_se) || dl_se->dl_yielded) { dl_se->dl_throttled = 1; __dequeue_task_dl(rq, curr, 0); if (unlikely(dl_se->dl_boosted || !start_dl_timer(curr))) -- 1.8.3.1