diff options
author | Tejun Heo <tj@kernel.org> | 2015-02-13 17:37:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:37 -0500 |
commit | 333470ee46b6851477dc9392eb71ba8ffa4f3387 (patch) | |
tree | a66ef9a7c1990fdca9a40051a852211c27ceaf24 /kernel | |
parent | ad853b48cb4650285e8544eebbba5bbd9274ee15 (diff) |
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/core.c | 10 | ||||
-rw-r--r-- | kernel/sched/stats.c | 11 |
2 files changed, 6 insertions, 15 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1f37fe7f77a4..13049aac05a6 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -5462,9 +5462,7 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, | |||
5462 | struct cpumask *groupmask) | 5462 | struct cpumask *groupmask) |
5463 | { | 5463 | { |
5464 | struct sched_group *group = sd->groups; | 5464 | struct sched_group *group = sd->groups; |
5465 | char str[256]; | ||
5466 | 5465 | ||
5467 | cpulist_scnprintf(str, sizeof(str), sched_domain_span(sd)); | ||
5468 | cpumask_clear(groupmask); | 5466 | cpumask_clear(groupmask); |
5469 | 5467 | ||
5470 | printk(KERN_DEBUG "%*s domain %d: ", level, "", level); | 5468 | 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, | |||
5477 | return -1; | 5475 | return -1; |
5478 | } | 5476 | } |
5479 | 5477 | ||
5480 | printk(KERN_CONT "span %s level %s\n", str, sd->name); | 5478 | printk(KERN_CONT "span %*pbl level %s\n", |
5479 | cpumask_pr_args(sched_domain_span(sd)), sd->name); | ||
5481 | 5480 | ||
5482 | if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) { | 5481 | if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) { |
5483 | printk(KERN_ERR "ERROR: domain->span does not contain " | 5482 | 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, | |||
5522 | 5521 | ||
5523 | cpumask_or(groupmask, groupmask, sched_group_cpus(group)); | 5522 | cpumask_or(groupmask, groupmask, sched_group_cpus(group)); |
5524 | 5523 | ||
5525 | cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group)); | 5524 | printk(KERN_CONT " %*pbl", |
5526 | 5525 | cpumask_pr_args(sched_group_cpus(group))); | |
5527 | printk(KERN_CONT " %s", str); | ||
5528 | if (group->sgc->capacity != SCHED_CAPACITY_SCALE) { | 5526 | if (group->sgc->capacity != SCHED_CAPACITY_SCALE) { |
5529 | printk(KERN_CONT " (cpu_capacity = %d)", | 5527 | printk(KERN_CONT " (cpu_capacity = %d)", |
5530 | group->sgc->capacity); | 5528 | group->sgc->capacity); |
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index a476bea17fbc..87e2c9f0c33e 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c | |||
@@ -15,11 +15,6 @@ | |||
15 | static int show_schedstat(struct seq_file *seq, void *v) | 15 | static int show_schedstat(struct seq_file *seq, void *v) |
16 | { | 16 | { |
17 | int cpu; | 17 | int cpu; |
18 | int mask_len = DIV_ROUND_UP(NR_CPUS, 32) * 9; | ||
19 | char *mask_str = kmalloc(mask_len, GFP_KERNEL); | ||
20 | |||
21 | if (mask_str == NULL) | ||
22 | return -ENOMEM; | ||
23 | 18 | ||
24 | if (v == (void *)1) { | 19 | if (v == (void *)1) { |
25 | seq_printf(seq, "version %d\n", SCHEDSTAT_VERSION); | 20 | seq_printf(seq, "version %d\n", SCHEDSTAT_VERSION); |
@@ -50,9 +45,8 @@ static int show_schedstat(struct seq_file *seq, void *v) | |||
50 | for_each_domain(cpu, sd) { | 45 | for_each_domain(cpu, sd) { |
51 | enum cpu_idle_type itype; | 46 | enum cpu_idle_type itype; |
52 | 47 | ||
53 | cpumask_scnprintf(mask_str, mask_len, | 48 | seq_printf(seq, "domain%d %*pb", dcount++, |
54 | sched_domain_span(sd)); | 49 | cpumask_pr_args(sched_domain_span(sd))); |
55 | seq_printf(seq, "domain%d %s", dcount++, mask_str); | ||
56 | for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; | 50 | for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; |
57 | itype++) { | 51 | itype++) { |
58 | seq_printf(seq, " %u %u %u %u %u %u %u %u", | 52 | 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) | |||
76 | rcu_read_unlock(); | 70 | rcu_read_unlock(); |
77 | #endif | 71 | #endif |
78 | } | 72 | } |
79 | kfree(mask_str); | ||
80 | return 0; | 73 | return 0; |
81 | } | 74 | } |
82 | 75 | ||