* [PATCH 0/2] sched: re-add removed arch_update_cpu_topology call
@ 2008-12-09 17:49 Heiko Carstens
2008-12-09 17:49 ` [PATCH 1/2] sched: let arch_update_cpu_topology indicate if topology changed Heiko Carstens
2008-12-09 17:49 ` [PATCH 2/2] sched: add missing arch_update_cpu_topology() call Heiko Carstens
0 siblings, 2 replies; 3+ messages in thread
From: Heiko Carstens @ 2008-12-09 17:49 UTC (permalink / raw)
To: akpm, mingo; +Cc: linux-kernel
arch_reinit_sched_domains used to call arch_update_cpu_topology
via arch_init_sched_domains. This call got lost with
e761b7725234276a802322549cee5255305a0930 ("cpu hotplug, sched: Introduce
cpu_active_map and redo sched domain managment (take 2)".
So we might end up with outdated and missing cpus in the cpu core
maps (architecture used to call arch_reinit_sched_domains if cpu
topology changed).
This patch set changes arch_update_cpu_topology so that it can indicate
if the cpu topology changed and adds a call to arch_update_cpu_topology
in partition_sched_domains which gets called whenever scheduling domains
get updated. Which is what is supposed to happen when cpu topology changes.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] sched: let arch_update_cpu_topology indicate if topology changed
2008-12-09 17:49 [PATCH 0/2] sched: re-add removed arch_update_cpu_topology call Heiko Carstens
@ 2008-12-09 17:49 ` Heiko Carstens
2008-12-09 17:49 ` [PATCH 2/2] sched: add missing arch_update_cpu_topology() call Heiko Carstens
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2008-12-09 17:49 UTC (permalink / raw)
To: akpm, mingo
Cc: linux-kernel, Max Krasnyansky, Martin Schwidefsky, Heiko Carstens
[-- Attachment #1: 001_arch_topology.diff --]
[-- Type: text/plain, Size: 2502 bytes --]
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Change arch_update_cpu_topology so it returns 1 if the cpu topology changed
and 0 if it didn't change. This will be useful for the next patch which adds
a call to this function in partition_sched_domains.
Cc: Max Krasnyansky <maxk@qualcomm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
arch/s390/kernel/topology.c | 5 +++--
include/linux/topology.h | 2 +-
kernel/sched.c | 8 +++++++-
3 files changed, 11 insertions(+), 4 deletions(-)
Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -7710,8 +7710,14 @@ static struct sched_domain_attr *dattr_c
*/
static cpumask_t fallback_doms;
-void __attribute__((weak)) arch_update_cpu_topology(void)
+/*
+ * arch_update_cpu_topology lets virtualized architectures update the
+ * cpu core maps. It is supposed to return 1 if the topology changed
+ * or 0 if it stayed the same.
+ */
+int __attribute__((weak)) arch_update_cpu_topology(void)
{
+ return 0;
}
/*
Index: linux-2.6/arch/s390/kernel/topology.c
===================================================================
--- linux-2.6.orig/arch/s390/kernel/topology.c
+++ linux-2.6/arch/s390/kernel/topology.c
@@ -212,7 +212,7 @@ static void update_cpu_core_map(void)
cpu_core_map[cpu] = cpu_coregroup_map(cpu);
}
-void arch_update_cpu_topology(void)
+int arch_update_cpu_topology(void)
{
struct tl_info *info = tl_info;
struct sys_device *sysdev;
@@ -221,7 +221,7 @@ void arch_update_cpu_topology(void)
if (!machine_has_topology) {
update_cpu_core_map();
topology_update_polarization_simple();
- return;
+ return 0;
}
stsi(info, 15, 1, 2);
tl_to_cores(info);
@@ -230,6 +230,7 @@ void arch_update_cpu_topology(void)
sysdev = get_cpu_sysdev(cpu);
kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
}
+ return 1;
}
static void topology_work_fn(struct work_struct *work)
Index: linux-2.6/include/linux/topology.h
===================================================================
--- linux-2.6.orig/include/linux/topology.h
+++ linux-2.6/include/linux/topology.h
@@ -49,7 +49,7 @@
for_each_online_node(node) \
if (nr_cpus_node(node))
-void arch_update_cpu_topology(void);
+int arch_update_cpu_topology(void);
/* Conform to ACPI 2.0 SLIT distance definitions */
#define LOCAL_DISTANCE 10
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] sched: add missing arch_update_cpu_topology() call
2008-12-09 17:49 [PATCH 0/2] sched: re-add removed arch_update_cpu_topology call Heiko Carstens
2008-12-09 17:49 ` [PATCH 1/2] sched: let arch_update_cpu_topology indicate if topology changed Heiko Carstens
@ 2008-12-09 17:49 ` Heiko Carstens
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2008-12-09 17:49 UTC (permalink / raw)
To: akpm, mingo
Cc: linux-kernel, Max Krasnyansky, Martin Schwidefsky, Heiko Carstens
[-- Attachment #1: 002_partition_update.diff --]
[-- Type: text/plain, Size: 2033 bytes --]
From: Heiko Carstens <heiko.carstens@de.ibm.com>
arch_reinit_sched_domains() used to call arch_update_cpu_topology()
via arch_init_sched_domains(). This call got lost with
e761b7725234276a802322549cee5255305a0930 ("cpu hotplug, sched: Introduce
cpu_active_map and redo sched domain managment (take 2)".
So we might end up with outdated and missing cpus in the cpu core
maps (architecture used to call arch_reinit_sched_domains if cpu
topology changed).
This adds a call to arch_update_cpu_topology in partition_sched_domains
which gets called whenever scheduling domains get updated. Which is
what is supposed to happen when cpu topology changes.
Cc: Max Krasnyansky <maxk@qualcomm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
kernel/sched.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -7811,17 +7811,21 @@ void partition_sched_domains(int ndoms_n
struct sched_domain_attr *dattr_new)
{
int i, j, n;
+ int new_topology;
mutex_lock(&sched_domains_mutex);
/* always unregister in case we don't destroy any domains */
unregister_sched_domain_sysctl();
+ /* Let architecture update cpu core mappings. */
+ new_topology = arch_update_cpu_topology();
+
n = doms_new ? ndoms_new : 0;
/* Destroy deleted domains */
for (i = 0; i < ndoms_cur; i++) {
- for (j = 0; j < n; j++) {
+ for (j = 0; j < n && !new_topology; j++) {
if (cpus_equal(doms_cur[i], doms_new[j])
&& dattrs_equal(dattr_cur, i, dattr_new, j))
goto match1;
@@ -7841,7 +7845,7 @@ match1:
/* Build new domains */
for (i = 0; i < ndoms_new; i++) {
- for (j = 0; j < ndoms_cur; j++) {
+ for (j = 0; j < ndoms_cur && !new_topology; j++) {
if (cpus_equal(doms_new[i], doms_cur[j])
&& dattrs_equal(dattr_new, i, dattr_cur, j))
goto match2;
--
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-09 17:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 17:49 [PATCH 0/2] sched: re-add removed arch_update_cpu_topology call Heiko Carstens
2008-12-09 17:49 ` [PATCH 1/2] sched: let arch_update_cpu_topology indicate if topology changed Heiko Carstens
2008-12-09 17:49 ` [PATCH 2/2] sched: add missing arch_update_cpu_topology() call Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox