I noticed that kernel has different console levels for the printk.
I also noticed this post .
I understand that we can change the /proc/sys/kernel/printk to change the printk level for the console; We can even use the dmesg --level to change the display level for dmesg.
However, my question is:
If I have a printk(KERN_DEBUG "debug message") line in the kernel, can I configure the system to advice kernel not to run the printk(KERN_DEBU ...) statement, instead of just not showing the message?
I don't want the kernel to run this printk because printk will cause some performance overhead. Even though we don't see the message print out by dmesg, the kernel may still save it somewhere else, which may slow down the system a little bit (say several ms), which I want to avoid.
Thank you very much for your time and help in this question!