Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1204646 > unrolled thread
| Started by | byungchul.park@lge.com |
|---|---|
| First post | 2015-08-11 02:30 +0200 |
| Last post | 2015-08-11 10:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2] sched: ensure a task has a non-normalized vruntime when returning back to cfs byungchul.park@lge.com - 2015-08-11 02:30 +0200
Re: [PATCH v2] sched: ensure a task has a non-normalized vruntime when returning back to cfs Peter Zijlstra <peterz@infradead.org> - 2015-08-11 10:10 +0200
| From | byungchul.park@lge.com |
|---|---|
| Date | 2015-08-11 02:30 +0200 |
| Subject | [PATCH v2] sched: ensure a task has a non-normalized vruntime when returning back to cfs |
| Message-ID | <pW5C3-5yL-13@gated-at.bofh.it> |
From: Byungchul Park <byungchul.park@lge.com>
change from v1 to v2
* fix build error in the case of !CONFIG_FAIR_GROUP_SCHED
----->8-----
From ee40520aef7a624fed14a2a50aed17966e0171e2 Mon Sep 17 00:00:00 2001
From: Byungchul Park <byungchul.park@lge.com>
Date: Tue, 11 Aug 2015 09:13:28 +0900
Subject: [PATCH v2] sched: ensure a task has a non-normalized vruntime when
returning back to cfs
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 (still !queue)
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
kernel/sched/fair.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ffa70dc..61e80b3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8142,16 +8142,31 @@ static void switched_from_fair(struct rq *rq, struct task_struct *p)
*/
static void switched_to_fair(struct rq *rq, struct task_struct *p)
{
-#ifdef CONFIG_FAIR_GROUP_SCHED
struct sched_entity *se = &p->se;
+
+#ifdef CONFIG_FAIR_GROUP_SCHED
/*
* Since the real-depth could have been changed (only FAIR
* class maintain depth value), reset depth properly.
*/
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/
[toc] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-08-11 10:10 +0200 |
| Subject | Re: [PATCH v2] sched: ensure a task has a non-normalized vruntime when returning back to cfs |
| Message-ID | <pWcNb-7FX-7@gated-at.bofh.it> |
| In reply to | #1204646 |
On Tue, Aug 11, 2015 at 09:20:06AM +0900, byungchul.park@lge.com wrote: > From: Byungchul Park <byungchul.park@lge.com> > > change from v1 to v2 > * fix build error in the case of !CONFIG_FAIR_GROUP_SCHED Ah, already fixed that. Thanks though. -- 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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web