[PATCH 4/4] printk: add task name and CPU to console messages

Sergey Senozhatsky
2017-12-04T13:55:45Z

*** FOR TESTING ***

Add current->comm/smp_processor_id() prefix to every console line.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
kernel/printk/printk.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a34a839e6045..a36cc6b9148e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1540,6 +1540,9 @@ static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf)
}
}

+ if (buf)
+ len += sprintf(buf, "{%s/%d}", current->comm,
+ smp_processor_id());
len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
return len;
}
--
2.15.1