[PATCH 12/12] percpu: use {cpu|node}mask pr_cont and seq output functions

2014-12-10 Thread Tejun Heo
Convert the existing user of cpu{mask|list}_scnprintf() and
node{mask|list}_scnprintf() which use them just to printk or
seq_printf() the resulting buffer to use the following functions
instead respectively.

* For printk: cpu{mask|list}_pr_cont() and node{mask|list}_pr_cont().

* For seq_file: seq_cpumask[_list]() and seq_nodemask[_list]().

Because these conversions usually break up a single output function
call into multiple, the reduction is LOC isn't too big but it removes
unnecessary complexity and/or arbitrary limit on the length printed.

This patch is dependent on the previous patch ("bitmap, cpumask,
nodemask: implement pr_cont variants of formatting functions") which
is planned to go through -mm.  It'd be the easiest to route this
together.  If this should go through the subsystem tree, please wait
till the forementioned patch is merged to mainline.

Signed-off-by: Tejun Heo 
Cc: Andrew Morton 
Cc: Christoph Lameter 
---
 mm/percpu.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index d39e2f4..3ff9b75 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1528,7 +1528,6 @@ static void pcpu_dump_alloc_info(const char *lvl,
 int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
  void *base_addr)
 {
-   static char cpus_buf[4096] __initdata;
static int smap[PERCPU_DYNAMIC_EARLY_SLOTS] __initdata;
static int dmap[PERCPU_DYNAMIC_EARLY_SLOTS] __initdata;
size_t dyn_size = ai->dyn_size;
@@ -1541,12 +1540,12 @@ int __init pcpu_setup_first_chunk(const struct 
pcpu_alloc_info *ai,
int *unit_map;
int group, unit, i;
 
-   cpumask_scnprintf(cpus_buf, sizeof(cpus_buf), cpu_possible_mask);
-
 #define PCPU_SETUP_BUG_ON(cond)do {
\
if (unlikely(cond)) {   \
pr_emerg("PERCPU: failed to initialize, %s", #cond);\
-   pr_emerg("PERCPU: cpu_possible_mask=%s\n", cpus_buf);   \
+   pr_emerg("PERCPU: cpu_possible_mask="); \
+   cpumask_pr_cont(cpu_possible_mask); \
+   pr_cont("\n");  \
pcpu_dump_alloc_info(KERN_EMERG, ai);   \
BUG();  \
}   \
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/12] percpu: use {cpu|node}mask pr_cont and seq output functions

2014-12-10 Thread Tejun Heo
Convert the existing user of cpu{mask|list}_scnprintf() and
node{mask|list}_scnprintf() which use them just to printk or
seq_printf() the resulting buffer to use the following functions
instead respectively.

* For printk: cpu{mask|list}_pr_cont() and node{mask|list}_pr_cont().

* For seq_file: seq_cpumask[_list]() and seq_nodemask[_list]().

Because these conversions usually break up a single output function
call into multiple, the reduction is LOC isn't too big but it removes
unnecessary complexity and/or arbitrary limit on the length printed.

This patch is dependent on the previous patch (bitmap, cpumask,
nodemask: implement pr_cont variants of formatting functions) which
is planned to go through -mm.  It'd be the easiest to route this
together.  If this should go through the subsystem tree, please wait
till the forementioned patch is merged to mainline.

Signed-off-by: Tejun Heo t...@kernel.org
Cc: Andrew Morton a...@linux-foundation.org
Cc: Christoph Lameter c...@linux-foundation.org
---
 mm/percpu.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index d39e2f4..3ff9b75 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1528,7 +1528,6 @@ static void pcpu_dump_alloc_info(const char *lvl,
 int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
  void *base_addr)
 {
-   static char cpus_buf[4096] __initdata;
static int smap[PERCPU_DYNAMIC_EARLY_SLOTS] __initdata;
static int dmap[PERCPU_DYNAMIC_EARLY_SLOTS] __initdata;
size_t dyn_size = ai-dyn_size;
@@ -1541,12 +1540,12 @@ int __init pcpu_setup_first_chunk(const struct 
pcpu_alloc_info *ai,
int *unit_map;
int group, unit, i;
 
-   cpumask_scnprintf(cpus_buf, sizeof(cpus_buf), cpu_possible_mask);
-
 #define PCPU_SETUP_BUG_ON(cond)do {
\
if (unlikely(cond)) {   \
pr_emerg(PERCPU: failed to initialize, %s, #cond);\
-   pr_emerg(PERCPU: cpu_possible_mask=%s\n, cpus_buf);   \
+   pr_emerg(PERCPU: cpu_possible_mask=); \
+   cpumask_pr_cont(cpu_possible_mask); \
+   pr_cont(\n);  \
pcpu_dump_alloc_info(KERN_EMERG, ai);   \
BUG();  \
}   \
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/