Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1203912
| From | byungchul.park@lge.com |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] sched: ensure a task has a non-normalized vruntime when returning back to cfs |
| Date | 2015-08-10 11:10 +0200 |
| Message-ID | <pVRfI-1wc-11@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
From: Byungchul Park <byungchul.park@lge.com>
current code ensures a task has a normalized vruntime when switching off
from fair class, but it does not ensure the task has a non-normalized
vruntime when switching back to the fair class.
this is an example breaking this consistency.
1. a task is in fair class and !queue
2. change its class to rt class (still !queue)
3. change its class to fair class again (stll !queue)
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
kernel/sched/fair.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ffa70dc..df265f5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8150,8 +8150,22 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p)
*/
se->depth = se->parent ? se->parent->depth + 1 : 0;
#endif
- if (!task_on_rq_queued(p))
+
+ if (!task_on_rq_queued(p)) {
+
+ /*
+ * Ensure the task has a non-normalized vruntime when it is switched
+ * back to the fair class with !queued, so that enqueue_entity() at
+ * wake-up time will do the right thing.
+ *
+ * If it's queued, then the enqueue_entity(.flags=0) makes the task
+ * has non-normalized vruntime, if it's !queued, then it still has
+ * normalized vruntime.
+ */
+ if (p->state != TASK_RUNNING)
+ se->vruntime += cfs_rq_of(se)->min_vruntime;
return;
+ }
/*
* We were most likely switched from sched_rt, so
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] sched: ensure a task has a non-normalized vruntime when returning back to cfs byungchul.park@lge.com - 2015-08-10 11:10 +0200
Re: [PATCH] sched: ensure a task has a non-normalized vruntime when returning back to cfs Peter Zijlstra <peterz@infradead.org> - 2015-08-10 14:20 +0200
Re: [PATCH] sched: ensure a task has a non-normalized vruntime when returning back to cfs Byungchul Park <byungchul.park@lge.com> - 2015-08-11 01:40 +0200
Re: [PATCH] sched: ensure a task has a non-normalized vruntime when returning back to cfs Byungchul Park <byungchul.park@lge.com> - 2015-08-11 02:10 +0200
[tip:sched/core] sched: Ensure a task has a non-normalized vruntime when returning back to CFS tip-bot for Byungchul Park <tipbot@zytor.com> - 2015-08-12 14:40 +0200
csiph-web