diff options
author | Andrew Vagin <avagin@openvz.org> | 2011-11-11 09:04:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-11-16 02:48:24 -0500 |
commit | a3e5d1091c1298ded486aba87c22fe90cb55ea6c (patch) | |
tree | 1db19d4ad6908411d9a0eeeaa86015d3152ba31f | |
parent | f4d6f6c2649c2c47261db4dcc3110d6f22202ea2 (diff) |
sched: Don't call task_group() too many times in set_task_rq()
It improves perfomance, especially if autogroup is enabled.
The size of set_task_rq() was 0x180 and now it is 0xa0.
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Acked-by: Paul Turner <pjt@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1321020240-3874331-1-git-send-email-avagin@openvz.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/sched.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 0df69866a04e..c9e3ab6e299e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -793,14 +793,18 @@ static inline struct task_group *task_group(struct task_struct *p) | |||
793 | /* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */ | 793 | /* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */ |
794 | static inline void set_task_rq(struct task_struct *p, unsigned int cpu) | 794 | static inline void set_task_rq(struct task_struct *p, unsigned int cpu) |
795 | { | 795 | { |
796 | #if defined(CONFIG_FAIR_GROUP_SCHED) || defined(CONFIG_RT_GROUP_SCHED) | ||
797 | struct task_group *tg = task_group(p); | ||
798 | #endif | ||
799 | |||
796 | #ifdef CONFIG_FAIR_GROUP_SCHED | 800 | #ifdef CONFIG_FAIR_GROUP_SCHED |
797 | p->se.cfs_rq = task_group(p)->cfs_rq[cpu]; | 801 | p->se.cfs_rq = tg->cfs_rq[cpu]; |
798 | p->se.parent = task_group(p)->se[cpu]; | 802 | p->se.parent = tg->se[cpu]; |
799 | #endif | 803 | #endif |
800 | 804 | ||
801 | #ifdef CONFIG_RT_GROUP_SCHED | 805 | #ifdef CONFIG_RT_GROUP_SCHED |
802 | p->rt.rt_rq = task_group(p)->rt_rq[cpu]; | 806 | p->rt.rt_rq = tg->rt_rq[cpu]; |
803 | p->rt.parent = task_group(p)->rt_se[cpu]; | 807 | p->rt.parent = tg->rt_se[cpu]; |
804 | #endif | 808 | #endif |
805 | } | 809 | } |
806 | 810 | ||