From: tip-bot for Peter Zijlstra <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, peterz@infradead.org, wanpeng.li@linux.intel.com,
juri.lelli@arm.com, mingo@kernel.org, ktkhai@parallels.com,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
tglx@linutronix.de
Subject: [tip:sched/core] sched/deadline: Fix stale yield state
Date: Wed, 4 Feb 2015 06:35:13 -0800 [thread overview]
Message-ID: <tip-1019a359d3dc4b64d0e1e5a5efcb725d5e83994d@git.kernel.org> (raw)
In-Reply-To: <1416962647-76792-4-git-send-email-wanpeng.li@linux.intel.com>
Commit-ID: 1019a359d3dc4b64d0e1e5a5efcb725d5e83994d
Gitweb: http://git.kernel.org/tip/1019a359d3dc4b64d0e1e5a5efcb725d5e83994d
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 26 Nov 2014 08:44:03 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 4 Feb 2015 07:52:26 +0100
sched/deadline: Fix stale yield state
When we fail to start the deadline timer in update_curr_dl(), we
forget to clear ->dl_yielded, resulting in wrecked time keeping.
Since the natural place to clear both ->dl_yielded and ->dl_throttled
is in replenish_dl_entity(); both are after all waiting for that event;
make it so.
Luckily since 67dfa1b756f2 ("sched/deadline: Implement
cancel_dl_timer() to use in switched_from_dl()") the
task_on_rq_queued() condition in dl_task_timer() must be true, and can
therefore call enqueue_task_dl() unconditionally.
Reported-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Kirill Tkhai <ktkhai@parallels.com>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1416962647-76792-4-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/deadline.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 7b684f9..a027799 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -350,6 +350,11 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se,
dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline;
dl_se->runtime = pi_se->dl_runtime;
}
+
+ if (dl_se->dl_yielded)
+ dl_se->dl_yielded = 0;
+ if (dl_se->dl_throttled)
+ dl_se->dl_throttled = 0;
}
/*
@@ -536,23 +541,19 @@ again:
sched_clock_tick();
update_rq_clock(rq);
- dl_se->dl_throttled = 0;
- dl_se->dl_yielded = 0;
- if (task_on_rq_queued(p)) {
- enqueue_task_dl(rq, p, ENQUEUE_REPLENISH);
- if (dl_task(rq->curr))
- check_preempt_curr_dl(rq, p, 0);
- else
- resched_curr(rq);
+ enqueue_task_dl(rq, p, ENQUEUE_REPLENISH);
+ if (dl_task(rq->curr))
+ check_preempt_curr_dl(rq, p, 0);
+ else
+ resched_curr(rq);
#ifdef CONFIG_SMP
- /*
- * Queueing this task back might have overloaded rq,
- * check if we need to kick someone away.
- */
- if (has_pushable_dl_tasks(rq))
- push_dl_task(rq);
+ /*
+ * Queueing this task back might have overloaded rq,
+ * check if we need to kick someone away.
+ */
+ if (has_pushable_dl_tasks(rq))
+ push_dl_task(rq);
#endif
- }
unlock:
raw_spin_unlock(&rq->lock);
@@ -613,10 +614,9 @@ static void update_curr_dl(struct rq *rq)
dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec;
if (dl_runtime_exceeded(rq, dl_se)) {
+ dl_se->dl_throttled = 1;
__dequeue_task_dl(rq, curr, 0);
- if (likely(start_dl_timer(dl_se, curr->dl.dl_boosted)))
- dl_se->dl_throttled = 1;
- else
+ if (unlikely(!start_dl_timer(dl_se, curr->dl.dl_boosted)))
enqueue_task_dl(rq, curr, ENQUEUE_REPLENISH);
if (!is_leftmost(curr, &rq->dl))
@@ -853,7 +853,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
* its rq, the bandwidth timer callback (which clearly has not
* run yet) will take care of this.
*/
- if (p->dl.dl_throttled)
+ if (p->dl.dl_throttled && !(flags & ENQUEUE_REPLENISH))
return;
enqueue_dl_entity(&p->dl, pi_se, flags);
next prev parent reply other threads:[~2015-02-04 14:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 0:44 [PATCH v6 0/7] sched: support dl task migration during cpu hotplug and other fixes Wanpeng Li
2014-11-26 0:44 ` [PATCH v6 1/7] sched/deadline: fix start high-res preemption tick for a non-leftmost task Wanpeng Li
2015-02-04 14:34 ` [tip:sched/core] sched/deadline: Fix hrtick " tip-bot for Wanpeng Li
2014-11-26 0:44 ` [PATCH v6 1/7] sched/deadline: fix start high-res preemption tick " Wanpeng Li
2014-11-26 0:34 ` Wanpeng Li
2014-11-26 0:44 ` [PATCH v6 3/7] sched/deadline: fix dl entity is still mark yield after replenishing Wanpeng Li
2015-02-04 14:35 ` tip-bot for Peter Zijlstra [this message]
2014-11-26 0:44 ` [PATCH v6 4/7] sched/deadline: reduce overhead if there are no scheduling parameters changed Wanpeng Li
2015-02-04 14:35 ` [tip:sched/core] sched/deadline: Avoid pointless __setscheduler() tip-bot for Wanpeng Li
2014-11-26 0:44 ` [PATCH v6 5/7] sched/fair: fix idle balance when remaining tasks are all non-CFS tasks Wanpeng Li
2015-01-19 12:45 ` Peter Zijlstra
2015-01-19 17:48 ` Tim Chen
2015-01-19 23:16 ` Wanpeng Li
2015-01-19 23:18 ` Wanpeng Li
2015-01-22 4:05 ` Wanpeng Li
2015-01-22 18:13 ` Tim Chen
2014-11-26 0:44 ` [PATCH v6 6/7] sched: fix start hrtick for short schedule slices on UP Wanpeng Li
2015-02-04 14:35 ` [tip:sched/core] sched: Fix hrtick_start() " tip-bot for Wanpeng Li
2014-11-26 0:44 ` [PATCH v6 7/7] sched/deadline: support dl task migration during cpu hotplug Wanpeng Li
2014-12-18 1:28 ` [PATCH v6 0/7] sched: support dl task migration during cpu hotplug and other fixes Wanpeng Li
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-1019a359d3dc4b64d0e1e5a5efcb725d5e83994d@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=juri.lelli@arm.com \
--cc=ktkhai@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=wanpeng.li@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.