History

sched: Fix SD_OVERLAP

SD_OVERLAP exists to allow overlapping groups, overlapping groups appear in NUMA topologies that aren't fully connected. The typical result of not fully connected NUMA is that each cpu (or rather node) will have different spans for a particular distance. However due to how sched domains are traversed -- only the first cpu in the mask goes one level up -- the next level only cares about the spans of the cpus that went up. Due to this two things were observed to be broken: - build_overlap_sched_groups() -- since its possible the cpu we're building the groups for exists in multiple (or all) groups, the selection criteria of the first group didn't ensure there was a cpu for which is was true that cpumask_first(span) == cpu. Thus load- balancing would terminate. - update_group_power() -- assumed that the cpu span of the first group of the domain was covered by all groups of the child domain. The above explains why this isn't true, so deal with it.

Peter Zijlstra committed 14 years ago

Commit 74a5ce21 parent 2ea45802 files · +25 −7Browse files

Showing the changes to kernel (2 of 2 files). Show all

Unified · Split

2 files
  1. kernel/sched/core.c +5 −2
  2. kernel/sched/fair.c +20 −5
kernel/sched/core.c+5−2
@@ -6030,11 +6030,14 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu) · 6029 unmodified lines
60306030
60316031 cpumask_or(covered, covered, sg_span);
60326032
6033− sg->sgp = *per_cpu_ptr(sdd->sgp, cpumask_first(sg_span));
6033+ sg->sgp = *per_cpu_ptr(sdd->sgp, i);
60346034 atomic_inc(&sg->sgp->ref);
60356035
6036− if (cpumask_test_cpu(cpu, sg_span))
6036+ if ((!groups && cpumask_test_cpu(cpu, sg_span)) ||
6037+ cpumask_first(sg_span) == cpu) {
6038+ WARN_ON_ONCE(!cpumask_test_cpu(cpu, sg_span));
60376039 groups = sg;
6040+ }
60386041
60396042 if (!first)
60406043 first = sg;
kernel/sched/fair.c+20−5
@@ -3574,11 +3574,26 @@ void update_group_power(struct sched_domain *sd, int cpu) · 3573 unmodified lines
35743574
35753575 power = 0;
35763576
3577− group = child->groups;
3578− do {
3579− power += group->sgp->power;
3580− group = group->next;
3581− } while (group != child->groups);
3577+ if (child->flags & SD_OVERLAP) {
3578+ /*
3579+ * SD_OVERLAP domains cannot assume that child groups
3580+ * span the current group.
3581+ */
3582+
3583+ for_each_cpu(cpu, sched_group_cpus(sdg))
3584+ power += power_of(cpu);
3585+ } else {
3586+ /*
3587+ * !SD_OVERLAP domains can assume that child groups
3588+ * span the current group.
3589+ */
3590+
3591+ group = child->groups;
3592+ do {
3593+ power += group->sgp->power;
3594+ group = group->next;
3595+ } while (group != child->groups);
3596+ }
35823597
35833598 sdg->sgp->power = power;
35843599 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t