]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
printk: nbcon: Use thread callback if in task context for legacy
authorJohn Ogness <john.ogness@linutronix.de>
Wed, 4 Sep 2024 12:05:27 +0000 (14:11 +0206)
committerPetr Mladek <pmladek@suse.com>
Wed, 4 Sep 2024 13:56:32 +0000 (15:56 +0200)
commit5c586baa60e46d9fccd04f04e16f8a50b2fbc1af
tree75b481dc75d82501907172afb48e1666dac2be97
parent9b79a3d0d64abae92457cb830baa6c6a717778b0
printk: nbcon: Use thread callback if in task context for legacy

When printing via console_lock, the write_atomic() callback is
used for nbcon consoles. However, if it is known that the
current context is a task context, the write_thread() callback
can be used instead.

Using write_thread() instead of write_atomic() helps to reduce
large disabled preemption regions when the device_lock does not
disable preemption.

This is mainly a preparatory change to allow avoiding
write_atomic() completely during normal operation if boot
consoles are registered.

As a side-effect, it also allows consolidating the printing
code for legacy printing and the kthread printer.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240904120536.115780-9-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
kernel/printk/internal.h
kernel/printk/nbcon.c
kernel/printk/printk.c