Skip to content

Commit 4497da6

Browse files
htejuntorvalds
authored andcommitted
padata: 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: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9e763e0 commit 4497da6

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

kernel/padata.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,10 @@ static ssize_t show_cpumask(struct padata_instance *pinst,
917917
else
918918
cpumask = pinst->cpumask.pcpu;
919919

920-
len = bitmap_scnprintf(buf, PAGE_SIZE, cpumask_bits(cpumask),
921-
nr_cpu_ids);
922-
if (PAGE_SIZE - len < 2)
923-
len = -EINVAL;
924-
else
925-
len += sprintf(buf + len, "\n");
926-
920+
len = snprintf(buf, PAGE_SIZE, "%*pb\n",
921+
nr_cpu_ids, cpumask_bits(cpumask));
927922
mutex_unlock(&pinst->lock);
928-
return len;
923+
return len < PAGE_SIZE ? len : -EINVAL;
929924
}
930925

931926
static ssize_t store_cpumask(struct padata_instance *pinst,

0 commit comments

Comments
 (0)