Commit 4dcf6aff authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent b15136e9
...@@ -5617,101 +5617,101 @@ int nr_cpu_ids __read_mostly = NR_CPUS; ...@@ -5617,101 +5617,101 @@ int nr_cpu_ids __read_mostly = NR_CPUS;
EXPORT_SYMBOL(nr_cpu_ids); EXPORT_SYMBOL(nr_cpu_ids);
#ifdef CONFIG_SCHED_DEBUG #ifdef CONFIG_SCHED_DEBUG
static void sched_domain_debug(struct sched_domain *sd, int cpu)
static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level)
{ {
int level = 0; struct sched_group *group = sd->groups;
cpumask_t groupmask;
char str[NR_CPUS];
if (!sd) { cpumask_scnprintf(str, NR_CPUS, sd->span);
printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu); cpus_clear(groupmask);
return;
printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
if (!(sd->flags & SD_LOAD_BALANCE)) {
printk("does not load-balance\n");
if (sd->parent)
printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
" has parent");
return -1;
} }
printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu); printk(KERN_CONT "span %s\n", str);
if (!cpu_isset(cpu, sd->span)) {
printk(KERN_ERR "ERROR: domain->span does not contain "
"CPU%d\n", cpu);
}
if (!cpu_isset(cpu, group->cpumask)) {
printk(KERN_ERR "ERROR: domain->groups does not contain"
" CPU%d\n", cpu);
}
printk(KERN_DEBUG "%*s groups:", level + 1, "");
do { do {
int i; if (!group) {
char str[NR_CPUS]; printk("\n");
struct sched_group *group = sd->groups; printk(KERN_ERR "ERROR: group is NULL\n");
cpumask_t groupmask;
cpumask_scnprintf(str, NR_CPUS, sd->span);
cpus_clear(groupmask);
printk(KERN_DEBUG);
for (i = 0; i < level + 1; i++)
printk(" ");
printk("domain %d: ", level);
if (!(sd->flags & SD_LOAD_BALANCE)) {
printk("does not load-balance\n");
if (sd->parent)
printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
" has parent");
break; break;
} }
printk("span %s\n", str); if (!group->__cpu_power) {
printk(KERN_CONT "\n");
printk(KERN_ERR "ERROR: domain->cpu_power not "
"set\n");
break;
}
if (!cpu_isset(cpu, sd->span)) if (!cpus_weight(group->cpumask)) {
printk(KERN_ERR "ERROR: domain->span does not contain " printk(KERN_CONT "\n");
"CPU%d\n", cpu); printk(KERN_ERR "ERROR: empty group\n");
if (!cpu_isset(cpu, group->cpumask)) break;
printk(KERN_ERR "ERROR: domain->groups does not contain" }
" CPU%d\n", cpu);
printk(KERN_DEBUG); if (cpus_intersects(groupmask, group->cpumask)) {
for (i = 0; i < level + 2; i++) printk(KERN_CONT "\n");
printk(" "); printk(KERN_ERR "ERROR: repeated CPUs\n");
printk("groups:"); break;
do { }
if (!group) {
printk("\n");
printk(KERN_ERR "ERROR: group is NULL\n");
break;
}
if (!group->__cpu_power) { cpus_or(groupmask, groupmask, group->cpumask);
printk(KERN_CONT "\n");
printk(KERN_ERR "ERROR: domain->cpu_power not "
"set\n");
break;
}
if (!cpus_weight(group->cpumask)) { cpumask_scnprintf(str, NR_CPUS, group->cpumask);
printk(KERN_CONT "\n"); printk(KERN_CONT " %s", str);
printk(KERN_ERR "ERROR: empty group\n");
break;
}
if (cpus_intersects(groupmask, group->cpumask)) { group = group->next;
printk(KERN_CONT "\n"); } while (group != sd->groups);
printk(KERN_ERR "ERROR: repeated CPUs\n"); printk(KERN_CONT "\n");
break;
}
cpus_or(groupmask, groupmask, group->cpumask); if (!cpus_equal(sd->span, groupmask))
printk(KERN_ERR "ERROR: groups don't span domain->span\n");
cpumask_scnprintf(str, NR_CPUS, group->cpumask); if (sd->parent && !cpus_subset(groupmask, sd->parent->span))
printk(KERN_CONT " %s", str); printk(KERN_ERR "ERROR: parent span is not a superset "
"of domain->span\n");
return 0;
}
group = group->next; static void sched_domain_debug(struct sched_domain *sd, int cpu)
} while (group != sd->groups); {
printk(KERN_CONT "\n"); int level = 0;
if (!cpus_equal(sd->span, groupmask)) if (!sd) {
printk(KERN_ERR "ERROR: groups don't span " printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
"domain->span\n"); return;
}
printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
for (;;) {
if (sched_domain_debug_one(sd, cpu, level))
break;
level++; level++;
sd = sd->parent; sd = sd->parent;
if (!sd) if (!sd)
continue; break;
}
if (!cpus_subset(groupmask, sd->span))
printk(KERN_ERR "ERROR: parent span is not a superset "
"of domain->span\n");
} while (sd);
} }
#else #else
# define sched_domain_debug(sd, cpu) do { } while (0) # define sched_domain_debug(sd, cpu) do { } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment