sched: use %*pb[l] to print bitmaps including cpumasks and nodemasks
printk and friends can now format bitmaps using '%*pb[l]'. cpumask and nodemask also provide cpumask_pr_args() and nodemask_pr_args() respectively which can be used to generate the two printf arguments necessary to format the specified cpu/nodemask. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ad853b48cb
commit
333470ee46
2 changed files with 6 additions and 15 deletions
|
@ -5462,9 +5462,7 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
|
||||||
struct cpumask *groupmask)
|
struct cpumask *groupmask)
|
||||||
{
|
{
|
||||||
struct sched_group *group = sd->groups;
|
struct sched_group *group = sd->groups;
|
||||||
char str[256];
|
|
||||||
|
|
||||||
cpulist_scnprintf(str, sizeof(str), sched_domain_span(sd));
|
|
||||||
cpumask_clear(groupmask);
|
cpumask_clear(groupmask);
|
||||||
|
|
||||||
printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
|
printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
|
||||||
|
@ -5477,7 +5475,8 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_CONT "span %s level %s\n", str, sd->name);
|
printk(KERN_CONT "span %*pbl level %s\n",
|
||||||
|
cpumask_pr_args(sched_domain_span(sd)), sd->name);
|
||||||
|
|
||||||
if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
|
if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
|
||||||
printk(KERN_ERR "ERROR: domain->span does not contain "
|
printk(KERN_ERR "ERROR: domain->span does not contain "
|
||||||
|
@ -5522,9 +5521,8 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
|
||||||
|
|
||||||
cpumask_or(groupmask, groupmask, sched_group_cpus(group));
|
cpumask_or(groupmask, groupmask, sched_group_cpus(group));
|
||||||
|
|
||||||
cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group));
|
printk(KERN_CONT " %*pbl",
|
||||||
|
cpumask_pr_args(sched_group_cpus(group)));
|
||||||
printk(KERN_CONT " %s", str);
|
|
||||||
if (group->sgc->capacity != SCHED_CAPACITY_SCALE) {
|
if (group->sgc->capacity != SCHED_CAPACITY_SCALE) {
|
||||||
printk(KERN_CONT " (cpu_capacity = %d)",
|
printk(KERN_CONT " (cpu_capacity = %d)",
|
||||||
group->sgc->capacity);
|
group->sgc->capacity);
|
||||||
|
|
|
@ -15,11 +15,6 @@
|
||||||
static int show_schedstat(struct seq_file *seq, void *v)
|
static int show_schedstat(struct seq_file *seq, void *v)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
int mask_len = DIV_ROUND_UP(NR_CPUS, 32) * 9;
|
|
||||||
char *mask_str = kmalloc(mask_len, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (mask_str == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
if (v == (void *)1) {
|
if (v == (void *)1) {
|
||||||
seq_printf(seq, "version %d\n", SCHEDSTAT_VERSION);
|
seq_printf(seq, "version %d\n", SCHEDSTAT_VERSION);
|
||||||
|
@ -50,9 +45,8 @@ static int show_schedstat(struct seq_file *seq, void *v)
|
||||||
for_each_domain(cpu, sd) {
|
for_each_domain(cpu, sd) {
|
||||||
enum cpu_idle_type itype;
|
enum cpu_idle_type itype;
|
||||||
|
|
||||||
cpumask_scnprintf(mask_str, mask_len,
|
seq_printf(seq, "domain%d %*pb", dcount++,
|
||||||
sched_domain_span(sd));
|
cpumask_pr_args(sched_domain_span(sd)));
|
||||||
seq_printf(seq, "domain%d %s", dcount++, mask_str);
|
|
||||||
for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES;
|
for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES;
|
||||||
itype++) {
|
itype++) {
|
||||||
seq_printf(seq, " %u %u %u %u %u %u %u %u",
|
seq_printf(seq, " %u %u %u %u %u %u %u %u",
|
||||||
|
@ -76,7 +70,6 @@ static int show_schedstat(struct seq_file *seq, void *v)
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
kfree(mask_str);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue