From: tip-bot for Luca Abeni <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, hpa@zytor.com, juri.lelli@gmail.com,
raistlin@linux.it, torvalds@linux-foundation.org,
peterz@infradead.org, mingo@kernel.org, luca.abeni@unitn.it
Subject: [tip:sched/urgent] sched/deadline: Avoid double-accounting in case of missed deadlines
Date: Fri, 9 Jan 2015 04:34:02 -0800 [thread overview]
Message-ID: <tip-269ad8015a6b2bb1cf9e684da4921eb6fa0a0c88@git.kernel.org> (raw)
In-Reply-To: <1418813432-20797-3-git-send-email-luca.abeni@unitn.it>
Commit-ID: 269ad8015a6b2bb1cf9e684da4921eb6fa0a0c88
Gitweb: http://git.kernel.org/tip/269ad8015a6b2bb1cf9e684da4921eb6fa0a0c88
Author: Luca Abeni <luca.abeni@unitn.it>
AuthorDate: Wed, 17 Dec 2014 11:50:32 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 9 Jan 2015 11:18:57 +0100
sched/deadline: Avoid double-accounting in case of missed deadlines
The dl_runtime_exceeded() function is supposed to ckeck if
a SCHED_DEADLINE task must be throttled, by checking if its
current runtime is <= 0. However, it also checks if the
scheduling deadline has been missed (the current time is
larger than the current scheduling deadline), further
decreasing the runtime if this happens.
This "double accounting" is wrong:
- In case of partitioned scheduling (or single CPU), this
happens if task_tick_dl() has been called later than expected
(due to small HZ values). In this case, the current runtime is
also negative, and replenish_dl_entity() can take care of the
deadline miss by recharging the current runtime to a value smaller
than dl_runtime
- In case of global scheduling on multiple CPUs, scheduling
deadlines can be missed even if the task did not consume more
runtime than expected, hence penalizing the task is wrong
This patch fix this problem by throttling a SCHED_DEADLINE task
only when its runtime becomes negative, and not modifying the runtime
Signed-off-by: Luca Abeni <luca.abeni@unitn.it>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@gmail.com>
Cc: <stable@vger.kernel.org>
Cc: Dario Faggioli <raistlin@linux.it>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1418813432-20797-3-git-send-email-luca.abeni@unitn.it
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/deadline.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 55af498..b52092f 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -570,24 +570,7 @@ void init_dl_task_timer(struct sched_dl_entity *dl_se)
static
int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se)
{
- int dmiss = dl_time_before(dl_se->deadline, rq_clock(rq));
- int rorun = dl_se->runtime <= 0;
-
- if (!rorun && !dmiss)
- return 0;
-
- /*
- * If we are beyond our current deadline and we are still
- * executing, then we have already used some of the runtime of
- * the next instance. Thus, if we do not account that, we are
- * stealing bandwidth from the system at each deadline miss!
- */
- if (dmiss) {
- dl_se->runtime = rorun ? dl_se->runtime : 0;
- dl_se->runtime -= rq_clock(rq) - dl_se->deadline;
- }
-
- return 1;
+ return (dl_se->runtime <= 0);
}
extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);
next prev parent reply other threads:[~2015-01-09 12:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 10:50 [PATCH 0/2] SCHED_DEADLINE fixes Luca Abeni
2014-12-17 10:50 ` [PATCH 1/2] Fix migration of SCHED_DEADLINE tasks Luca Abeni
2015-01-09 12:33 ` [tip:sched/urgent] sched/deadline: " tip-bot for Luca Abeni
2014-12-17 10:50 ` [PATCH 2/2] Avoid double-accounting in case of missed deadlines Luca Abeni
2015-01-09 12:34 ` tip-bot for Luca Abeni [this message]
2014-12-17 12:49 ` [PATCH 0/2] SCHED_DEADLINE fixes Juri Lelli
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=tip-269ad8015a6b2bb1cf9e684da4921eb6fa0a0c88@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=juri.lelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luca.abeni@unitn.it \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=raistlin@linux.it \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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