* [PATCH] sched: don't call task_group() many times in set_task_rq()
@ 2011-11-11 14:04 Andrew Vagin
2011-11-11 21:26 ` Paul Turner
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andrew Vagin @ 2011-11-11 14:04 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Peter Zijlstra, linux-kernel, devel
It improves perfomance, especially if autogroup enabled.
The size of set_task_rq() was 0x180 and now it is 0xa0.
Signed-off-by: Andrew Vagin <avagin@openvz.org>
---
kernel/sched.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index d87c6e5..a740eec 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -766,14 +766,18 @@ static inline struct task_group *task_group(struct task_struct *p)
/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
{
+#if defined(CONFIG_FAIR_GROUP_SCHED) || defined(CONFIG_RT_GROUP_SCHED)
+ struct task_group *tg = task_group(p);
+#endif
+
#ifdef CONFIG_FAIR_GROUP_SCHED
- p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
- p->se.parent = task_group(p)->se[cpu];
+ p->se.cfs_rq = tg->cfs_rq[cpu];
+ p->se.parent = tg->se[cpu];
#endif
#ifdef CONFIG_RT_GROUP_SCHED
- p->rt.rt_rq = task_group(p)->rt_rq[cpu];
- p->rt.parent = task_group(p)->rt_se[cpu];
+ p->rt.rt_rq = tg->rt_rq[cpu];
+ p->rt.parent = tg->rt_se[cpu];
#endif
}
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] sched: don't call task_group() many times in set_task_rq()
2011-11-11 14:04 [PATCH] sched: don't call task_group() many times in set_task_rq() Andrew Vagin
@ 2011-11-11 21:26 ` Paul Turner
2011-11-12 9:21 ` Peter Zijlstra
2011-11-11 21:47 ` Paul Turner
2011-11-18 23:43 ` [tip:sched/core] sched: Don't call task_group() too " tip-bot for Andrew Vagin
2 siblings, 1 reply; 5+ messages in thread
From: Paul Turner @ 2011-11-11 21:26 UTC (permalink / raw)
To: Andrew Vagin; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel, devel
On 11/11/2011 06:04 AM, Andrew Vagin wrote:
> It improves perfomance, especially if autogroup enabled.
>
> The size of set_task_rq() was 0x180 and now it is 0xa0.
A slightly more verbose commit message would be helpful here.
>
> Signed-off-by: Andrew Vagin<avagin@openvz.org>
Signed-off-by: Paul Turner <pjt@google.com>
> ---
> kernel/sched.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index d87c6e5..a740eec 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -766,14 +766,18 @@ static inline struct task_group *task_group(struct task_struct *p)
> /* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
> static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
> {
> +#if defined(CONFIG_FAIR_GROUP_SCHED) || defined(CONFIG_RT_GROUP_SCHED)
> + struct task_group *tg = task_group(p);
> +#endif
> +
> #ifdef CONFIG_FAIR_GROUP_SCHED
> - p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
> - p->se.parent = task_group(p)->se[cpu];
> + p->se.cfs_rq = tg->cfs_rq[cpu];
> + p->se.parent = tg->se[cpu];
> #endif
>
> #ifdef CONFIG_RT_GROUP_SCHED
> - p->rt.rt_rq = task_group(p)->rt_rq[cpu];
> - p->rt.parent = task_group(p)->rt_se[cpu];
> + p->rt.rt_rq = tg->rt_rq[cpu];
> + p->rt.parent = tg->rt_se[cpu];
> #endif
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] sched: don't call task_group() many times in set_task_rq()
2011-11-11 14:04 [PATCH] sched: don't call task_group() many times in set_task_rq() Andrew Vagin
2011-11-11 21:26 ` Paul Turner
@ 2011-11-11 21:47 ` Paul Turner
2011-11-18 23:43 ` [tip:sched/core] sched: Don't call task_group() too " tip-bot for Andrew Vagin
2 siblings, 0 replies; 5+ messages in thread
From: Paul Turner @ 2011-11-11 21:47 UTC (permalink / raw)
To: Andrew Vagin; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel, devel
For future note, please keep lists that don't allow cross-posting out of CC:
"You are not allowed to post to this mailing list, and your message has
been automatically rejected. If you think that your messages are
being rejected in error, contact the mailing list owner at
devel-owner@openvz.org."
Thanks,
- Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:sched/core] sched: Don't call task_group() too many times in set_task_rq()
2011-11-11 14:04 [PATCH] sched: don't call task_group() many times in set_task_rq() Andrew Vagin
2011-11-11 21:26 ` Paul Turner
2011-11-11 21:47 ` Paul Turner
@ 2011-11-18 23:43 ` tip-bot for Andrew Vagin
2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Andrew Vagin @ 2011-11-18 23:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, a.p.zijlstra, pjt, tglx, avagin, mingo
Commit-ID: a3e5d1091c1298ded486aba87c22fe90cb55ea6c
Gitweb: http://git.kernel.org/tip/a3e5d1091c1298ded486aba87c22fe90cb55ea6c
Author: Andrew Vagin <avagin@openvz.org>
AuthorDate: Fri, 11 Nov 2011 17:04:00 +0300
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 16 Nov 2011 08:48:24 +0100
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>
---
kernel/sched.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 0df6986..c9e3ab6 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -793,14 +793,18 @@ static inline struct task_group *task_group(struct task_struct *p)
/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
{
+#if defined(CONFIG_FAIR_GROUP_SCHED) || defined(CONFIG_RT_GROUP_SCHED)
+ struct task_group *tg = task_group(p);
+#endif
+
#ifdef CONFIG_FAIR_GROUP_SCHED
- p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
- p->se.parent = task_group(p)->se[cpu];
+ p->se.cfs_rq = tg->cfs_rq[cpu];
+ p->se.parent = tg->se[cpu];
#endif
#ifdef CONFIG_RT_GROUP_SCHED
- p->rt.rt_rq = task_group(p)->rt_rq[cpu];
- p->rt.parent = task_group(p)->rt_se[cpu];
+ p->rt.rt_rq = tg->rt_rq[cpu];
+ p->rt.parent = tg->rt_se[cpu];
#endif
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-18 23:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11 14:04 [PATCH] sched: don't call task_group() many times in set_task_rq() Andrew Vagin
2011-11-11 21:26 ` Paul Turner
2011-11-12 9:21 ` Peter Zijlstra
2011-11-11 21:47 ` Paul Turner
2011-11-18 23:43 ` [tip:sched/core] sched: Don't call task_group() too " tip-bot for Andrew Vagin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox