linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/6] mm: add some KERN_CONT markers to continuation lines
       [not found] <20101124085645.GW4693@pengutronix.de>
@ 2010-11-24  8:57 ` Uwe Kleine-König
  2011-02-28 15:17   ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2010-11-24  8:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Russell King - ARM Linux, kernel, Arjan van de Ven,
	Linus Torvalds, linux-mm

Cc: linux-mm@kvack.org
Signed-off-by: Uwe Kleine-KA?nig <u.kleine-koenig@pengutronix.de>
---
 mm/percpu.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index efe8168..3356646 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1117,20 +1117,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("%spcpu-alloc: ", lvl);
+				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.2.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 5/6] mm: add some KERN_CONT markers to continuation lines
  2010-11-24  8:57 ` [PATCH 5/6] mm: add some KERN_CONT markers to continuation lines Uwe Kleine-König
@ 2011-02-28 15:17   ` Uwe Kleine-König
  2011-03-01 21:46     ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2011-02-28 15:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Russell King - ARM Linux, kernel, Arjan van de Ven,
	Linus Torvalds, linux-mm

Hello,


On Wed, Nov 24, 2010 at 09:57:49AM +0100, Uwe Kleine-Konig wrote:
> Cc: linux-mm@kvack.org
> Signed-off-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
> ---
>  mm/percpu.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index efe8168..3356646 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -1117,20 +1117,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("%spcpu-alloc: ", lvl);
> +				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");
>  }
>  
>  /**
ping

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-Konig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 5/6] mm: add some KERN_CONT markers to continuation lines
  2011-02-28 15:17   ` Uwe Kleine-König
@ 2011-03-01 21:46     ` Linus Torvalds
  2011-03-02  5:28       ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2011-03-01 21:46 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-kernel, Russell King - ARM Linux, kernel, Arjan van de Ven,
	linux-mm

2011/2/28 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> Hello,
>
>
> On Wed, Nov 24, 2010 at 09:57:49AM +0100, Uwe Kleine-König wrote:
>> -                             printk("\n");
>> -                             printk("%spcpu-alloc: ", lvl);
>> +                             printk(KERN_CONT "\n");
>> +                             printk("%spcpu-alloc:", lvl);

So I hate this kind of "mindless search-and-replace" patch.

The whole point is that with the modern printk semantics, the above
kind of crazy cdoe shouldn't be needed. You should be able to just
write

     printk("%spcpu-alloc:", lvl);

without that "\n" at all, because printk() will insert the \n if
necessary. So the concept of

    printk(KERN_CONT "\n")

is just crazy: you're saying "I want to continue the line, in order to
print a newline". Whaa?

>> -                     printk("[%0*d] ", group_width, group);
>> +                     printk(KERN_CONT " [%0*d]", group_width, group);
>> -                                     printk("%0*d ", cpu_width,
>> +                                     printk(KERN_CONT " %0*d", cpu_width,
>> -                                     printk("%s ", empty_str);
>> +                                     printk(KERN_CONT " %s", empty_str);

These look ok, but:

>> -     printk("\n");
>> +     printk(KERN_CONT "\n");

Same deal. Why do KERN_CONT + "\n"?

Yes, yes, it does have semantic meaning ("do newline _now_"), and can
matter if you are going to use KERN_CONT exclusively around it. But it
still smells like just being silly to me. The point of the printk
changes was to make things simpler. I really would suggest just
removing those KERN_CONT "\n" lines. Doesn't it end up looking fine
that way too?

                     Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 5/6] mm: add some KERN_CONT markers to continuation lines
  2011-03-01 21:46     ` Linus Torvalds
@ 2011-03-02  5:28       ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2011-03-02  5:28 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Uwe Kleine-König, linux-kernel, Russell King - ARM Linux,
	kernel, Arjan van de Ven, linux-mm

On Tue, 2011-03-01 at 13:46 -0800, Linus Torvalds wrote:
> the concept of
>     printk(KERN_CONT "\n")
> is just crazy: you're saying "I want to continue the line, in order to
> print a newline". Whaa?

It's a trivially useful "end of collected printk" mark,
which was made a bit superfluous by the code that added
any necessary newline before every KERN_<level>.

There are a thousand or so of them today.

$ grep -rP --include=*.[ch] "\b(printk\s*\(\s*KERN_CONT|pr_cont\s*\(|printk\s*\()\s*\"\\\n\"" * | wc -l
1061

That code made all message terminating newlines a bit
obsolete.  I won't be submitting any patches to remove
those EOM newlines any time soon.

I hope no one does that.

It would be actually useful to have some form like:

	cookie = collected_printk_start()
loop:
		collected_printk(cookie, ...) (...)
	collected_printk_end(cookie)

so that interleaved messages from multiple
concurrent streams could be sensibly collected
either post processed or buffered.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2011-03-02  5:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20101124085645.GW4693@pengutronix.de>
2010-11-24  8:57 ` [PATCH 5/6] mm: add some KERN_CONT markers to continuation lines Uwe Kleine-König
2011-02-28 15:17   ` Uwe Kleine-König
2011-03-01 21:46     ` Linus Torvalds
2011-03-02  5:28       ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).