[Devel] [PATCH rh7 v2 2/2] sched/fair: Optimize is_top_cfs_rq()

Kirill Tkhai ktkhai at odin.com
Wed Sep 23 09:18:58 PDT 2015


Replace 5 loads with 2 loads.

May look strange, but this improves average results of
at_thread_ctxswitch_pipe test about 1%.

https://jira.sw.ru/browse/PSBM-35251

Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
---
 kernel/sched/fair.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8bc8c0f..ece14a4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -267,10 +267,9 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
 
 static inline bool is_top_cfs_rq(struct cfs_rq *cfs_rq)
 {
-	struct sched_entity *se;
+	struct task_group *tg = cfs_rq->tg;
 
-	se = cfs_rq->tg->se[cpu_of(rq_of(cfs_rq))];
-	return se && !se->parent;
+	return tg->parent == &root_task_group;
 }
 
 static inline struct cfs_rq *top_cfs_rq_of(struct sched_entity *se)




More information about the Devel mailing list