diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-10-24 12:23:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-24 12:23:48 -0400 |
commit | 4dcf6aff023d9934630fb3649284951831c51f8f (patch) | |
tree | ed949a5b38ec42579f077c96115cbca950b0bca3 /kernel/sched.c | |
parent | b15136e9497ef5d6e08cf665e0d0acf7a229f6dc (diff) |
sched: clean up sched_domain_debug()
clean up sched_domain_debug().
this also shrinks the code a bit:
text data bss dec hex filename
50474 4306 480 55260 d7dc sched.o.before
50404 4306 480 55190 d796 sched.o.after
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 80edf29fa27c..af02a4de069b 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -5617,101 +5617,101 @@ int nr_cpu_ids __read_mostly = NR_CPUS; | |||
5617 | EXPORT_SYMBOL(nr_cpu_ids); | 5617 | EXPORT_SYMBOL(nr_cpu_ids); |
5618 | 5618 | ||
5619 | #ifdef CONFIG_SCHED_DEBUG | 5619 | #ifdef CONFIG_SCHED_DEBUG |
5620 | static void sched_domain_debug(struct sched_domain *sd, int cpu) | 5620 | |
5621 | static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level) | ||
5621 | { | 5622 | { |
5622 | int level = 0; | 5623 | struct sched_group *group = sd->groups; |
5624 | cpumask_t groupmask; | ||
5625 | char str[NR_CPUS]; | ||
5623 | 5626 | ||
5624 | if (!sd) { | 5627 | cpumask_scnprintf(str, NR_CPUS, sd->span); |
5625 | printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu); | 5628 | cpus_clear(groupmask); |
5626 | return; | 5629 | |
5630 | printk(KERN_DEBUG "%*s domain %d: ", level, "", level); | ||
5631 | |||
5632 | if (!(sd->flags & SD_LOAD_BALANCE)) { | ||
5633 | printk("does not load-balance\n"); | ||
5634 | if (sd->parent) | ||
5635 | printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain" | ||
5636 | " has parent"); | ||
5637 | return -1; | ||
5627 | } | 5638 | } |
5628 | 5639 | ||
5629 | printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu); | 5640 | printk(KERN_CONT "span %s\n", str); |
5641 | |||
5642 | if (!cpu_isset(cpu, sd->span)) { | ||
5643 | printk(KERN_ERR "ERROR: domain->span does not contain " | ||
5644 | "CPU%d\n", cpu); | ||
5645 | } | ||
5646 | if (!cpu_isset(cpu, group->cpumask)) { | ||
5647 | printk(KERN_ERR "ERROR: domain->groups does not contain" | ||
5648 | " CPU%d\n", cpu); | ||
5649 | } | ||
5630 | 5650 | ||
5651 | printk(KERN_DEBUG "%*s groups:", level + 1, ""); | ||
5631 | do { | 5652 | do { |
5632 | int i; | 5653 | if (!group) { |
5633 | char str[NR_CPUS]; | 5654 | printk("\n"); |
5634 | struct sched_group *group = sd->groups; | 5655 | printk(KERN_ERR "ERROR: group is NULL\n"); |
5635 | cpumask_t groupmask; | ||
5636 | |||
5637 | cpumask_scnprintf(str, NR_CPUS, sd->span); | ||
5638 | cpus_clear(groupmask); | ||
5639 | |||
5640 | printk(KERN_DEBUG); | ||
5641 | for (i = 0; i < level + 1; i++) | ||
5642 | printk(" "); | ||
5643 | printk("domain %d: ", level); | ||
5644 | |||
5645 | if (!(sd->flags & SD_LOAD_BALANCE)) { | ||
5646 | printk("does not load-balance\n"); | ||
5647 | if (sd->parent) | ||
5648 | printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain" | ||
5649 | " has parent"); | ||
5650 | break; | 5656 | break; |
5651 | } | 5657 | } |
5652 | 5658 | ||
5653 | printk("span %s\n", str); | 5659 | if (!group->__cpu_power) { |
5660 | printk(KERN_CONT "\n"); | ||
5661 | printk(KERN_ERR "ERROR: domain->cpu_power not " | ||
5662 | "set\n"); | ||
5663 | break; | ||
5664 | } | ||
5654 | 5665 | ||
5655 | if (!cpu_isset(cpu, sd->span)) | 5666 | if (!cpus_weight(group->cpumask)) { |
5656 | printk(KERN_ERR "ERROR: domain->span does not contain " | 5667 | printk(KERN_CONT "\n"); |
5657 | "CPU%d\n", cpu); | 5668 | printk(KERN_ERR "ERROR: empty group\n"); |
5658 | if (!cpu_isset(cpu, group->cpumask)) | 5669 | break; |
5659 | printk(KERN_ERR "ERROR: domain->groups does not contain" | 5670 | } |
5660 | " CPU%d\n", cpu); | ||
5661 | 5671 | ||
5662 | printk(KERN_DEBUG); | 5672 | if (cpus_intersects(groupmask, group->cpumask)) { |
5663 | for (i = 0; i < level + 2; i++) | 5673 | printk(KERN_CONT "\n"); |
5664 | printk(" "); | 5674 | printk(KERN_ERR "ERROR: repeated CPUs\n"); |
5665 | printk("groups:"); | 5675 | break; |
5666 | do { | 5676 | } |
5667 | if (!group) { | ||
5668 | printk("\n"); | ||
5669 | printk(KERN_ERR "ERROR: group is NULL\n"); | ||
5670 | break; | ||
5671 | } | ||
5672 | 5677 | ||
5673 | if (!group->__cpu_power) { | 5678 | cpus_or(groupmask, groupmask, group->cpumask); |
5674 | printk(KERN_CONT "\n"); | ||
5675 | printk(KERN_ERR "ERROR: domain->cpu_power not " | ||
5676 | "set\n"); | ||
5677 | break; | ||
5678 | } | ||
5679 | 5679 | ||
5680 | if (!cpus_weight(group->cpumask)) { | 5680 | cpumask_scnprintf(str, NR_CPUS, group->cpumask); |
5681 | printk(KERN_CONT "\n"); | 5681 | printk(KERN_CONT " %s", str); |
5682 | printk(KERN_ERR "ERROR: empty group\n"); | ||
5683 | break; | ||
5684 | } | ||
5685 | 5682 | ||
5686 | if (cpus_intersects(groupmask, group->cpumask)) { | 5683 | group = group->next; |
5687 | printk(KERN_CONT "\n"); | 5684 | } while (group != sd->groups); |
5688 | printk(KERN_ERR "ERROR: repeated CPUs\n"); | 5685 | printk(KERN_CONT "\n"); |
5689 | break; | ||
5690 | } | ||
5691 | 5686 | ||
5692 | cpus_or(groupmask, groupmask, group->cpumask); | 5687 | if (!cpus_equal(sd->span, groupmask)) |
5688 | printk(KERN_ERR "ERROR: groups don't span domain->span\n"); | ||
5693 | 5689 | ||
5694 | cpumask_scnprintf(str, NR_CPUS, group->cpumask); | 5690 | if (sd->parent && !cpus_subset(groupmask, sd->parent->span)) |
5695 | printk(KERN_CONT " %s", str); | 5691 | printk(KERN_ERR "ERROR: parent span is not a superset " |
5692 | "of domain->span\n"); | ||
5693 | return 0; | ||
5694 | } | ||
5696 | 5695 | ||
5697 | group = group->next; | 5696 | static void sched_domain_debug(struct sched_domain *sd, int cpu) |
5698 | } while (group != sd->groups); | 5697 | { |
5699 | printk(KERN_CONT "\n"); | 5698 | int level = 0; |
5700 | 5699 | ||
5701 | if (!cpus_equal(sd->span, groupmask)) | 5700 | if (!sd) { |
5702 | printk(KERN_ERR "ERROR: groups don't span " | 5701 | printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu); |
5703 | "domain->span\n"); | 5702 | return; |
5703 | } | ||
5704 | 5704 | ||
5705 | printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu); | ||
5706 | |||
5707 | for (;;) { | ||
5708 | if (sched_domain_debug_one(sd, cpu, level)) | ||
5709 | break; | ||
5705 | level++; | 5710 | level++; |
5706 | sd = sd->parent; | 5711 | sd = sd->parent; |
5707 | if (!sd) | 5712 | if (!sd) |
5708 | continue; | 5713 | break; |
5709 | 5714 | } | |
5710 | if (!cpus_subset(groupmask, sd->span)) | ||
5711 | printk(KERN_ERR "ERROR: parent span is not a superset " | ||
5712 | "of domain->span\n"); | ||
5713 | |||
5714 | } while (sd); | ||
5715 | } | 5715 | } |
5716 | #else | 5716 | #else |
5717 | # define sched_domain_debug(sd, cpu) do { } while (0) | 5717 | # define sched_domain_debug(sd, cpu) do { } while (0) |