Re: [PATCH 5/6] mm: add some KERN_CONT markers to continuation lines

From: Linus Torvalds
Date: Tue Mar 01 2011 - 16:47:19 EST


2011/2/28 Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>:
> 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/