[PATCH] sched: make vruntime_normalized() cleaner
From: Byungchul Park
Date: Tue Sep 01 2015 - 21:59:58 EST
in both TASK_ON_RQ_QUEUED case and TASK_ON_RQ_MIGRATING case, the
target task have a normalized vruntime by dequeue_entity(.flags=0).
so we don't need to check this separately with a different condition
statement.
Signed-off-by: Byungchul Park <byungchul.park@xxxxxxx>
---
kernel/sched/fair.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 53d0e30..dfe8754 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7920,14 +7920,14 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio)
static inline bool vruntime_normalized(struct task_struct *p)
{
- int queued = task_on_rq_queued(p);
struct sched_entity *se = &p->se;
/*
- * If it's queued, then the dequeue_entity(.flags=0) will already
- * have normalized the vruntime.
+ * In both TASK_ON_RQ_QUEUED case and TASK_ON_RQ_MIGRATING case,
+ * the dequeue_entity(.flags=0) will already have normalized the
+ * vruntime.
*/
- if (queued)
+ if (p->on_rq)
return true;
/*
@@ -7942,14 +7942,6 @@ static inline bool vruntime_normalized(struct task_struct *p)
if (!se->sum_exec_runtime || p->state == TASK_WAKING)
return true;
- /*
- * If it's !queued, then only when the task is sleeping it has a
- * non-normalized vruntime, that is, when the task is being migrated
- * it has a normailized vruntime.
- */
- if (p->state == TASK_RUNNING)
- return true;
-
return false;
}
--
1.7.9.5
>
> And the problem with tracking the vruntime state is that while it helps
> detach_task_cfs_rq(), attach_task_cfs_rq() is still left wondering what
> it should return to.
>
> So we do indeed need something to determine, based on the current state,
> if vruntime should be normalized.
>
> /me ponders moar
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/