forked from Minki/linux
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>
This commit is contained in:
parent
b15136e949
commit
4dcf6aff02
160
kernel/sched.c
160
kernel/sched.c
@ -5617,6 +5617,82 @@ int nr_cpu_ids __read_mostly = NR_CPUS;
|
||||
EXPORT_SYMBOL(nr_cpu_ids);
|
||||
|
||||
#ifdef CONFIG_SCHED_DEBUG
|
||||
|
||||
static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level)
|
||||
{
|
||||
struct sched_group *group = sd->groups;
|
||||
cpumask_t groupmask;
|
||||
char str[NR_CPUS];
|
||||
|
||||
cpumask_scnprintf(str, NR_CPUS, sd->span);
|
||||
cpus_clear(groupmask);
|
||||
|
||||
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_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 {
|
||||
if (!group) {
|
||||
printk("\n");
|
||||
printk(KERN_ERR "ERROR: group is NULL\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!group->__cpu_power) {
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_ERR "ERROR: domain->cpu_power not "
|
||||
"set\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!cpus_weight(group->cpumask)) {
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_ERR "ERROR: empty group\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (cpus_intersects(groupmask, group->cpumask)) {
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_ERR "ERROR: repeated CPUs\n");
|
||||
break;
|
||||
}
|
||||
|
||||
cpus_or(groupmask, groupmask, group->cpumask);
|
||||
|
||||
cpumask_scnprintf(str, NR_CPUS, group->cpumask);
|
||||
printk(KERN_CONT " %s", str);
|
||||
|
||||
group = group->next;
|
||||
} while (group != sd->groups);
|
||||
printk(KERN_CONT "\n");
|
||||
|
||||
if (!cpus_equal(sd->span, groupmask))
|
||||
printk(KERN_ERR "ERROR: groups don't span domain->span\n");
|
||||
|
||||
if (sd->parent && !cpus_subset(groupmask, sd->parent->span))
|
||||
printk(KERN_ERR "ERROR: parent span is not a superset "
|
||||
"of domain->span\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sched_domain_debug(struct sched_domain *sd, int cpu)
|
||||
{
|
||||
int level = 0;
|
||||
@ -5628,90 +5704,14 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu)
|
||||
|
||||
printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
|
||||
|
||||
do {
|
||||
int i;
|
||||
char str[NR_CPUS];
|
||||
struct sched_group *group = sd->groups;
|
||||
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");
|
||||
for (;;) {
|
||||
if (sched_domain_debug_one(sd, cpu, level))
|
||||
break;
|
||||
}
|
||||
|
||||
printk("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);
|
||||
for (i = 0; i < level + 2; i++)
|
||||
printk(" ");
|
||||
printk("groups:");
|
||||
do {
|
||||
if (!group) {
|
||||
printk("\n");
|
||||
printk(KERN_ERR "ERROR: group is NULL\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!group->__cpu_power) {
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_ERR "ERROR: domain->cpu_power not "
|
||||
"set\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!cpus_weight(group->cpumask)) {
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_ERR "ERROR: empty group\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (cpus_intersects(groupmask, group->cpumask)) {
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_ERR "ERROR: repeated CPUs\n");
|
||||
break;
|
||||
}
|
||||
|
||||
cpus_or(groupmask, groupmask, group->cpumask);
|
||||
|
||||
cpumask_scnprintf(str, NR_CPUS, group->cpumask);
|
||||
printk(KERN_CONT " %s", str);
|
||||
|
||||
group = group->next;
|
||||
} while (group != sd->groups);
|
||||
printk(KERN_CONT "\n");
|
||||
|
||||
if (!cpus_equal(sd->span, groupmask))
|
||||
printk(KERN_ERR "ERROR: groups don't span "
|
||||
"domain->span\n");
|
||||
|
||||
level++;
|
||||
sd = sd->parent;
|
||||
if (!sd)
|
||||
continue;
|
||||
|
||||
if (!cpus_subset(groupmask, sd->span))
|
||||
printk(KERN_ERR "ERROR: parent span is not a superset "
|
||||
"of domain->span\n");
|
||||
|
||||
} while (sd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define sched_domain_debug(sd, cpu) do { } while (0)
|
||||
|
Loading…
Reference in New Issue
Block a user