mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xunlei Pang <xlpang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@arm.com>, Ingo Molnar <mingo@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Luca Abeni <luca.abeni@santannapisa.it>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Xunlei Pang <xlpang@redhat.com>, Luca Abeni <luca.abeni@unitn.it>
Subject: [PATCH v2 2/3] sched/deadline: Throttle the task when missing its deadline
Date: Fri, 12 May 2017 11:32:08 +0800	[thread overview]
Message-ID: <1494559929-11462-2-git-send-email-xlpang@redhat.com> (raw)
In-Reply-To: <1494559929-11462-1-git-send-email-xlpang@redhat.com>

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 <luca.abeni@unitn.it>
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
---
 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

  reply	other threads:[~2017-05-12  3:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12  3:32 [PATCH v2 1/3] sched/deadline: Zero out positive runtime after throttling constrained tasks Xunlei Pang
2017-05-12  3:32 ` Xunlei Pang [this message]
2017-05-12  5:57   ` [PATCH v2 2/3] sched/deadline: Throttle the task when missing its deadline luca abeni
2017-05-12  6:53     ` Xunlei Pang
2017-05-12  7:01       ` luca abeni
2017-05-12  7:19         ` Xunlei Pang
2017-05-12 20:58           ` luca abeni
2017-05-15  3:50             ` Xunlei Pang
2017-05-12  3:32 ` [PATCH v2 3/3] sched/deadline: Add statistics to track runtime underruns Xunlei Pang
2017-05-15  4:07 ` [PATCH v2 1/3] sched/deadline: Zero out positive runtime after throttling constrained tasks Xunlei Pang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494559929-11462-2-git-send-email-xlpang@redhat.com \
    --to=xlpang@redhat.com \
    --cc=bristot@redhat.com \
    --cc=juri.lelli@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.abeni@santannapisa.it \
    --cc=luca.abeni@unitn.it \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®