All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info()
@ 2012-03-29 16:48 Tejun Heo
  2012-03-29 18:10 ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2012-03-29 16:48 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-kernel, Kay Sievers

>From cb129820f1e6ccf309510f4eb28df45cb0742005 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Thu, 29 Mar 2012 09:45:58 -0700

pcpu_dump_alloc_info() was printing continued lines without KERN_CONT.
Use it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Kay Sievers <kay.sievers@vrfy.org>
---
Committed to percpu/for-3.4-fixes.

Thanks.

 mm/percpu.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index f47af91..f921fdf 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1132,20 +1132,20 @@ static void pcpu_dump_alloc_info(const char *lvl,
 		for (alloc_end += gi->nr_units / upa;
 		     alloc < alloc_end; alloc++) {
 			if (!(alloc % apl)) {
-				printk("\n");
+				printk(KERN_CONT "\n");
 				printk("%spcpu-alloc: ", lvl);
 			}
-			printk("[%0*d] ", group_width, group);
+			printk(KERN_CONT "[%0*d] ", group_width, group);
 
 			for (unit_end += upa; unit < unit_end; unit++)
 				if (gi->cpu_map[unit] != NR_CPUS)
-					printk("%0*d ", cpu_width,
+					printk(KERN_CONT "%0*d ", cpu_width,
 					       gi->cpu_map[unit]);
 				else
-					printk("%s ", empty_str);
+					printk(KERN_CONT "%s ", empty_str);
 		}
 	}
-	printk("\n");
+	printk(KERN_CONT "\n");
 }
 
 /**
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info()
  2012-03-29 16:48 [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info() Tejun Heo
@ 2012-03-29 18:10 ` Joe Perches
  2012-03-29 19:51   ` Tejun Heo
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2012-03-29 18:10 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Christoph Lameter, linux-kernel, Kay Sievers

On Thu, 2012-03-29 at 09:48 -0700, Tejun Heo wrote:
> >From cb129820f1e6ccf309510f4eb28df45cb0742005 Mon Sep 17 00:00:00 2001
> From: Tejun Heo <tj@kernel.org>
> Date: Thu, 29 Mar 2012 09:45:58 -0700
> 
> pcpu_dump_alloc_info() was printing continued lines without KERN_CONT.
> Use it.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Reported-by: Kay Sievers <kay.sievers@vrfy.org>
> ---
> Committed to percpu/for-3.4-fixes.
> 
> Thanks.
> 
>  mm/percpu.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index f47af91..f921fdf 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -1132,20 +1132,20 @@ static void pcpu_dump_alloc_info(const char *lvl,
>  		for (alloc_end += gi->nr_units / upa;
>  		     alloc < alloc_end; alloc++) {
>  			if (!(alloc % apl)) {
> -				printk("\n");
> +				printk(KERN_CONT "\n");
>  				printk("%spcpu-alloc: ", lvl);
>  			}
> -			printk("[%0*d] ", group_width, group);
> +			printk(KERN_CONT "[%0*d] ", group_width, group);
>  
>  			for (unit_end += upa; unit < unit_end; unit++)
>  				if (gi->cpu_map[unit] != NR_CPUS)
> -					printk("%0*d ", cpu_width,
> +					printk(KERN_CONT "%0*d ", cpu_width,
>  					       gi->cpu_map[unit]);
>  				else
> -					printk("%s ", empty_str);
> +					printk(KERN_CONT "%s ", empty_str);
>  		}
>  	}
> -	printk("\n");
> +	printk(KERN_CONT "\n");
>  }

Perhaps it's better to try to print lines
in fewer printks?  Maybe use a line buffer?

The first line could be newline terminated.
"if (alloc)" tests for the individual newlines could be added.
Why aren't the group widths on separate lines?
All of the cpu_widths are on the same line as the parent group
even if that exceeds apl.  Is that what's desired?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info()
  2012-03-29 18:10 ` Joe Perches
@ 2012-03-29 19:51   ` Tejun Heo
  2012-03-29 20:06     ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2012-03-29 19:51 UTC (permalink / raw)
  To: Joe Perches; +Cc: Christoph Lameter, linux-kernel, Kay Sievers

Hello, Joe.

On Thu, Mar 29, 2012 at 11:10 AM, Joe Perches <joe@perches.com> wrote:
> Perhaps it's better to try to print lines
> in fewer printks?  Maybe use a line buffer?

What practical difference would that make?

> The first line could be newline terminated.
> "if (alloc)" tests for the individual newlines could be added.
> Why aren't the group widths on separate lines?
> All of the cpu_widths are on the same line as the parent group
> even if that exceeds apl.  Is that what's desired?

I frankly don't remember. I wanted something easy on the eye during
the development to verify the config results and it worked well enough
for me. If you can simplify it, please go ahead and submit a patch.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info()
  2012-03-29 19:51   ` Tejun Heo
@ 2012-03-29 20:06     ` Joe Perches
  2012-03-29 20:11       ` Tejun Heo
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2012-03-29 20:06 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Christoph Lameter, linux-kernel, Kay Sievers

On Thu, 2012-03-29 at 12:51 -0700, Tejun Heo wrote:
> Hello, Joe.

Hello Tejun.

> On Thu, Mar 29, 2012 at 11:10 AM, Joe Perches <joe@perches.com> wrote:
> > Perhaps it's better to try to print lines
> > in fewer printks?  Maybe use a line buffer?
> What practical difference would that make?

It'd be just for avoidance of any other possible
interleaving from other threads.

It's an __init function so that's not too likely,
but if it every happens...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info()
  2012-03-29 20:06     ` Joe Perches
@ 2012-03-29 20:11       ` Tejun Heo
  2012-04-01 13:29         ` Kay Sievers
  0 siblings, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2012-03-29 20:11 UTC (permalink / raw)
  To: Joe Perches; +Cc: Christoph Lameter, linux-kernel, Kay Sievers

Hello,

On Thu, Mar 29, 2012 at 1:06 PM, Joe Perches <joe@perches.com> wrote:
> It'd be just for avoidance of any other possible
> interleaving from other threads.
>
> It's an __init function so that's not too likely,
> but if it every happens...

Ah, okay.  Forgot about that.  Yeah, the kernel is single threaded at
that point, so it shouldn't matter. The code is rather complex so
something simpler would be nice, I agree.

Another thing is that we seem to have structured logging coming our
way and maybe userspace can deal with racing continuing printks? Not
sure how different streams could be distinguished tho. Maybe the
printing task can be used to group them? Kay, is this something
structured logging would solve?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info()
  2012-03-29 20:11       ` Tejun Heo
@ 2012-04-01 13:29         ` Kay Sievers
  2012-04-01 14:55           ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Kay Sievers @ 2012-04-01 13:29 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Joe Perches, Christoph Lameter, linux-kernel

On Thu, Mar 29, 2012 at 22:11, Tejun Heo <tj@kernel.org> wrote:
> On Thu, Mar 29, 2012 at 1:06 PM, Joe Perches <joe@perches.com> wrote:
>> It'd be just for avoidance of any other possible
>> interleaving from other threads.
>>
>> It's an __init function so that's not too likely,
>> but if it every happens...
>
> Ah, okay.  Forgot about that.  Yeah, the kernel is single threaded at
> that point, so it shouldn't matter. The code is rather complex so
> something simpler would be nice, I agree.
>
> Another thing is that we seem to have structured logging coming our
> way and maybe userspace can deal with racing continuing printks? Not
> sure how different streams could be distinguished tho. Maybe the
> printing task can be used to group them? Kay, is this something
> structured logging would solve?

The kernel's printk() uses a static scratch buffer of 1024 chars. The
prototype for the printk() with facility and structure support I have,
does a bit better and more reliable 'buffered IO' than the current
one.

If interleaved printk messages are still a problem, we could allocate
a per-cpu scratch buffer and all continuation lines which stay on the
same CPU would share the same buffer before it is committed to the
global log buffer.

Kay

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info()
  2012-04-01 13:29         ` Kay Sievers
@ 2012-04-01 14:55           ` Joe Perches
  0 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2012-04-01 14:55 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Tejun Heo, Christoph Lameter, linux-kernel

On Sun, 2012-04-01 at 15:29 +0200, Kay Sievers wrote:
> The kernel's printk() uses a static scratch buffer of 1024 chars. The
> prototype for the printk() with facility and structure support I have,
> does a bit better and more reliable 'buffered IO' than the current
> one.

Can you send me a link to your code please?



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-01 14:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 16:48 [PATCH] percpu: use KERN_CONT in pcpu_dump_alloc_info() Tejun Heo
2012-03-29 18:10 ` Joe Perches
2012-03-29 19:51   ` Tejun Heo
2012-03-29 20:06     ` Joe Perches
2012-03-29 20:11       ` Tejun Heo
2012-04-01 13:29         ` Kay Sievers
2012-04-01 14:55           ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.