[PATCH/RFC 1/5] [PATCH] sched: merge cpu_to_core_group functions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Heiko Carstens
Date: Thursday, August 12, 2010 - 10:25 am

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Merge and simplify the two cpu_to_core_group variants so that the
resulting function follows the same pattern like cpu_to_phys_group.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---

 kernel/sched.c |   18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff -urpN linux-2.6/kernel/sched.c linux-2.6-patched/kernel/sched.c
--- linux-2.6/kernel/sched.c	2010-08-11 13:47:16.000000000 +0200
+++ linux-2.6-patched/kernel/sched.c	2010-08-11 13:47:22.000000000 +0200
@@ -6546,31 +6546,23 @@ cpu_to_cpu_group(int cpu, const struct c
 #ifdef CONFIG_SCHED_MC
 static DEFINE_PER_CPU(struct static_sched_domain, core_domains);
 static DEFINE_PER_CPU(struct static_sched_group, sched_group_core);
-#endif /* CONFIG_SCHED_MC */
 
-#if defined(CONFIG_SCHED_MC) && defined(CONFIG_SCHED_SMT)
 static int
 cpu_to_core_group(int cpu, const struct cpumask *cpu_map,
 		  struct sched_group **sg, struct cpumask *mask)
 {
 	int group;
-
+#ifdef CONFIG_SCHED_SMT
 	cpumask_and(mask, topology_thread_cpumask(cpu), cpu_map);
 	group = cpumask_first(mask);
+#else
+	group = cpu;
+#endif
 	if (sg)
 		*sg = &per_cpu(sched_group_core, group).sg;
 	return group;
 }
-#elif defined(CONFIG_SCHED_MC)
-static int
-cpu_to_core_group(int cpu, const struct cpumask *cpu_map,
-		  struct sched_group **sg, struct cpumask *unused)
-{
-	if (sg)
-		*sg = &per_cpu(sched_group_core, cpu).sg;
-	return cpu;
-}
-#endif
+#endif /* CONFIG_SCHED_MC */
 
 static DEFINE_PER_CPU(struct static_sched_domain, phys_domains);
 static DEFINE_PER_CPU(struct static_sched_group, sched_group_phys);

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH/RFC 0/5] sched: add new 'book' scheduling domain, Heiko Carstens, (Thu Aug 12, 10:25 am)
[PATCH/RFC 1/5] [PATCH] sched: merge cpu_to_core_group fun ..., Heiko Carstens, (Thu Aug 12, 10:25 am)
[PATCH/RFC 3/5] [PATCH] sched: add book scheduling domain, Heiko Carstens, (Thu Aug 12, 10:25 am)
Re: [PATCH/RFC 0/5] sched: add new 'book' scheduling domain, Andreas Herrmann, (Thu Aug 19, 5:22 am)