[Devel] [PATCH RHEL7 COMMIT] sched/fair: Optimize is_top_cfs_rq()

Vladimir Davydov vdavydov at virtuozzo.com
Thu Sep 24 02:22:07 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.9
------>
commit 1c12b1b1990e17c04fb09de7d2728d7f3a383b6c
Author: Kirill Tkhai <ktkhai at odin.com>
Date:   Thu Sep 24 13:22:07 2015 +0400

    sched/fair: Optimize is_top_cfs_rq()
    
    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>
    Reviewed-by: Vladimir Davydov <vdavydov at parallels.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 8bc8c0fb0ce8..ece14a41cb96 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