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,52 +5617,38 @@ int nr_cpu_ids __read_mostly = NR_CPUS; ...@@ -5617,52 +5617,38 @@ 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)
{
int level = 0;
if (!sd) { static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level)
printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu); {
return;
}
printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
do {
int i;
char str[NR_CPUS];
struct sched_group *group = sd->groups; struct sched_group *group = sd->groups;
cpumask_t groupmask; cpumask_t groupmask;
char str[NR_CPUS];
cpumask_scnprintf(str, NR_CPUS, sd->span); cpumask_scnprintf(str, NR_CPUS, sd->span);
cpus_clear(groupmask); cpus_clear(groupmask);
printk(KERN_DEBUG); printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
for (i = 0; i < level + 1; i++)
printk(" ");
printk("domain %d: ", level);
if (!(sd->flags & SD_LOAD_BALANCE)) { if (!(sd->flags & SD_LOAD_BALANCE)) {
printk("does not load-balance\n"); printk("does not load-balance\n");
if (sd->parent) if (sd->parent)
printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain" printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
" has parent"); " has parent");
break; return -1;
} }
printk("span %s\n", str); printk(KERN_CONT "span %s\n", str);
if (!cpu_isset(cpu, sd->span)) if (!cpu_isset(cpu, sd->span)) {
printk(KERN_ERR "ERROR: domain->span does not contain " printk(KERN_ERR "ERROR: domain->span does not contain "
"CPU%d\n", cpu); "CPU%d\n", cpu);
if (!cpu_isset(cpu, group->cpumask)) }
if (!cpu_isset(cpu, group->cpumask)) {
printk(KERN_ERR "ERROR: domain->groups does not contain" printk(KERN_ERR "ERROR: domain->groups does not contain"
" CPU%d\n", cpu); " CPU%d\n", cpu);
}
printk(KERN_DEBUG); printk(KERN_DEBUG "%*s groups:", level + 1, "");
for (i = 0; i < level + 2; i++)
printk(" ");
printk("groups:");
do { do {
if (!group) { if (!group) {
printk("\n"); printk("\n");
...@@ -5699,19 +5685,33 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu) ...@@ -5699,19 +5685,33 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu)
printk(KERN_CONT "\n"); printk(KERN_CONT "\n");
if (!cpus_equal(sd->span, groupmask)) if (!cpus_equal(sd->span, groupmask))
printk(KERN_ERR "ERROR: groups don't span " printk(KERN_ERR "ERROR: groups don't span domain->span\n");
"domain->span\n");
level++;
sd = sd->parent;
if (!sd)
continue;
if (!cpus_subset(groupmask, sd->span)) if (sd->parent && !cpus_subset(groupmask, sd->parent->span))
printk(KERN_ERR "ERROR: parent span is not a superset " printk(KERN_ERR "ERROR: parent span is not a superset "
"of domain->span\n"); "of domain->span\n");
return 0;
}
static void sched_domain_debug(struct sched_domain *sd, int cpu)
{
int level = 0;
if (!sd) {
printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
return;
}
printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
} while (sd); for (;;) {
if (sched_domain_debug_one(sd, cpu, level))
break;
level++;
sd = sd->parent;
if (!sd)
break;
}
} }
#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