public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu
@ 2013-06-04 11:20 Viresh Kumar
  2013-06-04 11:20 ` [PATCH 2/2] sched: Remove unused params of build_sched_domain() Viresh Kumar
  2013-06-05  4:42 ` [PATCH 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu Michael Wang
  0 siblings, 2 replies; 8+ messages in thread
From: Viresh Kumar @ 2013-06-04 11:20 UTC (permalink / raw)
  To: mingo, peterz
  Cc: linaro-kernel, patches, linux-kernel, robin.randhawa,
	Steve.Bannister, Liviu.Dudau, charles.garcia-tobin,
	arvind.chauhan, Viresh Kumar

We are saving first scheduling domain for a cpu in build_sched_domains() by
iterating over the nested sd->child list. We don't actually need to do it this
way.

*per_cpu_ptr(d.sd, i) is guaranteed to be NULL in the beginning as we have
called __visit_domain_allocation_hell() which does a memset to zero for struct
s_data.

So, save pointer to first SD while running the iteration loop over tl's.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/sched/core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 58453b8..638f6cb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6533,16 +6533,13 @@ static int build_sched_domains(const struct cpumask *cpu_map,
 		sd = NULL;
 		for (tl = sched_domain_topology; tl->init; tl++) {
 			sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i);
+			if (!*per_cpu_ptr(d.sd, i))
+				*per_cpu_ptr(d.sd, i) = sd;
 			if (tl->flags & SDTL_OVERLAP || sched_feat(FORCE_SD_OVERLAP))
 				sd->flags |= SD_OVERLAP;
 			if (cpumask_equal(cpu_map, sched_domain_span(sd)))
 				break;
 		}
-
-		while (sd->child)
-			sd = sd->child;
-
-		*per_cpu_ptr(d.sd, i) = sd;
 	}
 
 	/* Build the groups for the domains */
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-06-05 13:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04 11:20 [PATCH 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu Viresh Kumar
2013-06-04 11:20 ` [PATCH 2/2] sched: Remove unused params of build_sched_domain() Viresh Kumar
2013-06-05  4:42 ` [PATCH 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu Michael Wang
2013-06-05  5:07   ` Viresh Kumar
2013-06-05  5:26     ` Michael Wang
2013-06-05 11:04     ` Peter Zijlstra
2013-06-05 12:42       ` Viresh Kumar
2013-06-05 13:03         ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox