sched: consolidate sched domains]
PATCH 1/1 sched: consolidate sched domains]
Could we get this in please? The current screw up in the scheduling domain patch means that any architecture that actually hotplugs CPUs will crash in find_busiest_group() ... and I notice this has just bitten the z Series people...
James
Quoted 1 line · William Lee Irwin III
Okay, if you prefer the #ifdef:
And for the other half of it:
kernel/sched.c +9 -0
@@ -4224,7 +4224,11 @@ sd = &per_cpu (phys_domains, i); group =cpu_to_phys_group (i); *sd =SD_CPU_INIT ; +#ifdef CONFIG_NUMA sd->span = nodemask; +#else + sd->span = cpu_possible_map; +#endif sd->parent = p; sd->groups = &sched_group_phys[group];
@@ -4262,6 +4266,7 @@ &cpu_to_isolated_group); } +#ifdef CONFIG_NUMA /* Set up physical groups */ for (i =0 ; i <MAX_NUMNODES ; i++) {cpumask_t nodemask =node_to_cpumask (i);
@@ -4273,6 +4278,10 @@init_sched_build_groups (sched_group_phys, nodemask, &cpu_to_phys_group); } +#else +init_sched_build_groups (sched_group_phys, cpu_possible_map, + &cpu_to_phys_group); +#endif #ifdef CONFIG_NUMA /* Set up node groups */
Quoted 5 lines · James Bottomley
Could we get this in please? The current screw up in the scheduling domain patch means that any architecture that actually hotplugs CPUs will crash in
find_busiest_group()... and I notice this has just bitten the z Series people...
Have we yet seen anything which looks like a completed and tested patch?
Quoted 8 lines · Andrew Morton
Quoted 5 lines · James Bottomley
Could we get this in please? The current screw up in the scheduling domain patch means that any architecture that actually hotplugs CPUs will crash in
find_busiest_group()... and I notice this has just bitten the z Series people...Have we yet seen anything which looks like a completed and tested patch?
The attached was what I've tested on parisc. It looks complete to me; what's wrong with it?
James
Quoted 4 lines · James Bottomley
Quoted 4 lines
Could we get this in please? The current screw up in the scheduling domain patch means that any architecture that actually hotplugs CPUs will crash in
find_busiest_group()... and I notice this has just bitten the z Series people...
Quoted 1 line · Andrew Morton
Have we yet seen anything which looks like a completed and tested patch?
This is the whole thing; the "other half" referred to a new hunk added to the patch (identical to this one) posted in its entirety.
-- wli
A message that is not in the archive (sent off-list or not yet received): [email protected]
[sched] fix sched_domains hotplug bootstrap ordering vs. cpu_online_map issue
Quoted 2 lines · William Lee Irwin III
Quoted 2 lines
This is the whole thing; the "other half" referred to a new hunk added to the patch (identical to this one) posted in its entirety.
Quoted 1 line · Andrew Morton
ho-hum. changelog, please?
cpu_online_map is not set up at the time of sched domain initialization when hotplug cpu paths are used for SMP booting. At this phase of bootstrapping, cpu_possible_map can be used by the various architectures using cpu hotplugging for SMP bootstrap, but the manipulations of cpu_online_map done on behalf of NUMA architectures, done indirectly via node_to_cpumask(), can't, because cpu_online_map starts depopulated and hasn't yet been populated. On true NUMA architectures this is a distinct cpumask_t from cpu_online_map and so the unpatched code works on NUMA; on non-NUMA architectures the definition of node_to_cpumask() this way breaks and would require an invasive sweeping of users of node_to_cpumask() to change it to e.g. cpu_possible_map, as cpu_possible_map is not suitable for use at runtime as a substitute for cpu_online_map.
kernel/sched.c +9 -0
@@ -4224,7 +4224,11 @@ sd = &per_cpu (phys_domains, i); group =cpu_to_phys_group (i); *sd =SD_CPU_INIT ; +#ifdef CONFIG_NUMA sd->span = nodemask; +#else + sd->span = cpu_possible_map; +#endif sd->parent = p; sd->groups = &sched_group_phys[group];
@@ -4262,6 +4266,7 @@ &cpu_to_isolated_group); } +#ifdef CONFIG_NUMA /* Set up physical groups */ for (i =0 ; i <MAX_NUMNODES ; i++) {cpumask_t nodemask =node_to_cpumask (i);
@@ -4273,6 +4278,10 @@init_sched_build_groups (sched_group_phys, nodemask, &cpu_to_phys_group); } +#else +init_sched_build_groups (sched_group_phys, cpu_possible_map, + &cpu_to_phys_group); +#endif #ifdef CONFIG_NUMA /* Set up node groups */
Re: [sched] fix sched_domains hotplug bootstrap ordering vs. cpu_online_map issue
Quoted 25 lines · William Lee Irwin III
Quoted 2 lines · William Lee Irwin III
Quoted 2 lines
This is the whole thing; the "other half" referred to a new hunk added to the patch (identical to this one) posted in its entirety.
Quoted 1 line · Andrew Morton
ho-hum. changelog, please?
cpu_online_mapis not set up at the time of sched domain initialization when hotplug cpu paths are used for SMP booting. At this phase of bootstrapping,cpu_possible_mapcan be used by the various architectures using cpu hotplugging for SMP bootstrap, but the manipulations ofcpu_online_mapdone on behalf of NUMA architectures, done indirectly vianode_to_cpumask(), can't, becausecpu_online_mapstarts depopulated and hasn't yet been populated. On true NUMA architectures this is a distinctcpumask_tfromcpu_online_mapand so the unpatched code works on NUMA; on non-NUMA architectures the definition ofnode_to_cpumask()this way breaks and would require an invasive sweeping of users ofnode_to_cpumask()to change it to e.g.cpu_possible_map, ascpu_possible_mapis not suitable for use at runtime as a substitute forcpu_online_map.
Quoted 2 lines
Signed-off-by William Irwin <[email protected]>
Yeah I guess this is probably the best thing to do for now.
Martin, I wonder if this patch fixes your z/VM problem?
Re: [sched] fix sched_domains hotplug bootstrap ordering vs. cpu_online_map issue
In reply to William Lee Irwin IIIQuoted 21 lines · William Lee Irwin III
Quoted 2 lines · William Lee Irwin III
Quoted 2 lines
This is the whole thing; the "other half" referred to a new hunk added to the patch (identical to this one) posted in its entirety.
Quoted 1 line · Andrew Morton
ho-hum. changelog, please?
cpu_online_mapis not set up at the time of sched domain initialization when hotplug cpu paths are used for SMP booting. At this phase of bootstrapping,cpu_possible_mapcan be used by the various architectures using cpu hotplugging for SMP bootstrap, but the manipulations ofcpu_online_mapdone on behalf of NUMA architectures, done indirectly vianode_to_cpumask(), can't, becausecpu_online_mapstarts depopulated and hasn't yet been populated. On true NUMA architectures this is a distinctcpumask_tfromcpu_online_mapand so the unpatched code works on NUMA; on non-NUMA architectures the definition ofnode_to_cpumask()this way breaks and would require an invasive sweeping of users ofnode_to_cpumask()to change it to e.g.cpu_possible_map, ascpu_possible_mapis not suitable for use at runtime as a substitute forcpu_online_map.
Quoted 1 line
Signed-off-by William Irwin <[email protected]>
Ingo
Re: [sched] fix sched_domains hotplug bootstrap ordering vs. cpu_online_map issue
Quoted 14 lines · Ingo Molnar
Quoted 14 lines
cpu_online_mapis not set up at the time of sched domain initialization when hotplug cpu paths are used for SMP booting. At this phase of bootstrapping,cpu_possible_mapcan be used by the various architectures using cpu hotplugging for SMP bootstrap, but the manipulations ofcpu_online_mapdone on behalf of NUMA architectures, done indirectly vianode_to_cpumask(), can't, becausecpu_online_mapstarts depopulated and hasn't yet been populated. On true NUMA architectures this is a distinctcpumask_tfromcpu_online_mapand so the unpatched code works on NUMA; on non-NUMA architectures the definition ofnode_to_cpumask()this way breaks and would require an invasive sweeping of users ofnode_to_cpumask()to change it to e.g.cpu_possible_map, ascpu_possible_mapis not suitable for use at runtime as a substitute forcpu_online_map.
Quoted 3 lines
Quoted 1 line
Signed-off-by William Irwin <[email protected]>Signed-off-by Ingo Molnar <[email protected]>
Well this patch got in, which is what I want, since it allows the non-NUMA machines to work with hotplug CPUs again. However, is anyone actually looking to fix this for real?
The fundamental problem is that NUMA or the scheduler (or both) are broken with regard to hotplug.
The origin of the breakage is the differences between cpu_possible_map and cpu_online_map. In hotplug CPU, there are two ways to do
initialisations: you can initialise from cpu_online_map, but then you *must* have a cpu hotplug notify listener to add data structures for the extra CPUs as they come on-line, or you can initialise from cpu_possible_map and not bother with a notifier. The disadvantage of the latter is that cpu_possible_map may be vastly larger than cpu_online_map ever gets to, thus wasting valuable kernel memory.
The scheduler code is schizophrenic in this regard in that it does both:
it initialises static data structures from cpu_possible_map, but it also has a hotplug cpu listener for starting things like the migration threads.
I suspect the NUMA people would like us all to go to the former method (initialise only from cpu_online_map and have a proper hotplug listener) since their possible maps are pretty huge. However, which is it to be:
fix NUMA (to have two cpu_to_node() maps for the possible and online cpus per node) or fix the scheduler to do initialisation correctly?
Perhaps this should be phased: change NUMA first temporarily for phase one and then fix the scheduler (and everyone else initialising from cpu_possible_map) in the second.
James
Re: [sched] fix sched_domains hotplug bootstrap ordering vs. cpu_online_map issue
Quoted 6 lines · James Bottomley
Well this patch got in, which is what I want, since it allows the non-NUMA machines to work with hotplug CPUs again. However, is anyone actually looking to fix this for real?
I think someone else (tm) is looking at it :)
Some of the IBM hotplug guys I think.
Quoted 23 lines
The fundamental problem is that NUMA or the scheduler (or both) are broken with regard to hotplug.
The origin of the breakage is the differences between
cpu_possible_mapandcpu_online_map. In hotplug CPU, there are two ways to do
initialisations: you can initialise fromcpu_online_map, but then you *must* have a cpu hotplug notify listener to add data structures for the extra CPUs as they come on-line, or you can initialise fromcpu_possible_mapand not bother with a notifier. The disadvantage of the latter is thatcpu_possible_mapmay be vastly larger thancpu_online_mapever gets to, thus wasting valuable kernel memory.The scheduler code is schizophrenic in this regard in that it does both:
it initialises static data structures fromcpu_possible_map, but it also has a hotplug cpu listener for starting things like the migration threads.I suspect the NUMA people would like us all to go to the former method (initialise only from
cpu_online_mapand have a proper hotplug listener) since their possible maps are pretty huge. However, which is it to be:
fix NUMA (to have twocpu_to_node()maps for the possible and online cpus per node) or fix the scheduler to do initialisation correctly?
Quoted 5 lines
Perhaps this should be phased: change NUMA first temporarily for phase one and then fix the scheduler (and everyone else initialising from
cpu_possible_map) in the second.
The scheduler *should* be able to be fixed nicely by using cpu_online_map everywhere, and basically undoing then redoing the domains setup before and after the hoplug, respectively.
So you'd re-attach the dummy domain to all CPUs, do the hotplug operation, then setup the domains again and re-attach them.
This whole sequence could be pretty expensive, but I don't think the hotplug guys care. It would allow us to get rid of cpus_and(... cpu_online_map) from a lot of places in the scheduler too, which would be nice.
The actual code to do it shouldn't be more than a few lines (but I could be overlooking something).