History

sched: Always initialize cpu-power

Often when we run into mis-shapen topologies the balance iteration fails to update the cpu power properly and we'll end up in /0 traps. Always initialize the cpu-power to a semi-sane value so that we can at least boot the machine, even if the load-balancer might not function correctly.

Peter Zijlstra committed 14 years ago

Commit c3decf01 parent c1174872 files · +13 −2Browse files

Unified · Split

2 files
  1. kernel/sched/core.c +12 −1
  2. kernel/sched/fair.c +1 −1
kernel/sched/core.c+12−1
@@ -5604,7 +5604,12 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, · 5603 unmodified lines
5604 break;5604 break;
5605 }5605 }
5606 5606
5607 if (!group->sgp->power) {5607 /*
5608 * Even though we initialize ->power to something semi-sane,
5609 * we leave power_orig unset. This allows us to detect if
5610 * domain iteration is still funny without causing /0 traps.
5611 */
5612 if (!group->sgp->power_orig) {
5608 printk(KERN_CONT "\n");5613 printk(KERN_CONT "\n");
5609 printk(KERN_ERR "ERROR: domain->cpu_power not "5614 printk(KERN_ERR "ERROR: domain->cpu_power not "
5610 "set\n");5615 "set\n");
@@ -6075,6 +6080,12 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu) · 464 unmodified lines
6075 if (atomic_inc_return(&sg->sgp->ref) == 1)6080 if (atomic_inc_return(&sg->sgp->ref) == 1)
6076 build_group_mask(sd, sg);6081 build_group_mask(sd, sg);
6077 6082
6083 /*
6084 * Initialize sgp->power such that even if we mess up the
6085 * domains and no possible iteration will get us here, we won't
6086 * die on a /0 trap.
6087 */
6088 sg->sgp->power = SCHED_POWER_SCALE * cpumask_weight(sg_span);
6078 6089
6079 /*6090 /*
6080 * Make sure the first group of this domain contains the6091 * Make sure the first group of this domain contains the
kernel/sched/fair.c+1−1
@@ -3602,7 +3602,7 @@ void update_group_power(struct sched_domain *sd, int cpu) · 3601 unmodified lines
3602 } while (group != child->groups);3602 } while (group != child->groups);
3603 }3603 }
3604 3604
3605 sdg->sgp->power = power;3605 sdg->sgp->power_orig = sdg->sgp->power = power;
3606}3606}
3607 3607
3608/*3608/*

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