printk: convert the format for KERN_<LEVEL> to a 2 byte pattern

Instead of "<.>", use an ASCII SOH for the KERN_<LEVEL> prefix initiator.

This saves 1 byte per printk, thousands of bytes in a normal kernel.

No output changes are produced as vprintk_emit converts these uses to
"<.>".

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Joe Perches 2012-07-30 14:40:17 -07:00 committed by Linus Torvalds
parent b778b3f25b
commit 04d2c8c83d
2 changed files with 16 additions and 13 deletions

View file

@ -9,7 +9,7 @@ extern const char linux_proc_banner[];
static inline int printk_get_level(const char *buffer)
{
if (buffer[0] == '<' && buffer[1] && buffer[2] == '>') {
if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
switch (buffer[1]) {
case '0' ... '7':
case 'd': /* KERN_DEFAULT */
@ -27,7 +27,7 @@ static inline const char *printk_skip_level(const char *buffer)
case '0' ... '7':
case 'd': /* KERN_DEFAULT */
case 'c': /* KERN_CONT */
return buffer + 3;
return buffer + 2;
}
}
return buffer;