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>
diff --git a/include/linux/printk.h b/include/linux/printk.h
index fea2de3..93a231f 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -9,7 +9,7 @@
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 @@
case '0' ... '7':
case 'd': /* KERN_DEFAULT */
case 'c': /* KERN_CONT */
- return buffer + 3;
+ return buffer + 2;
}
}
return buffer;