Linux Gets Patches For Threaded Console Printing

Written by Michael Larabel in Linux Kernel on 7 February 2022 at 07:20 PM EST. 12 Comments
LINUX KERNEL
There has been a multi-year effort to overhaul the Linux kernel's printk() code and as part of that the newest patch series out is providing threaded console printing support.

This threaded console printing support is fulfilling plans drafted back in 2019 to create a kernel thread for each registered console and making console printing completely decoupled from printk() callers.

John Ogness who has been heavily involved in the printk() rework explained of this threaded console printing code:
This series implements a kthread for each registered console. The kthreads locklessly retrieve the records from the printk ringbuffer and also do not cause any lock contention between one another. This allows consoles to run at full speed. For example, a netconsole is able to dump records much faster than a serial or vt console.

Ogness went on to add, "There are situations where kthread printing is not sufficient. For example, during early boot before kthreads exist or during panic situations, where the kthreads may not get a chance to schedule. In these cases, the current method of printing directly within the printk() caller context is used."


This threaded console printing support in its initial form is reworking less than one thousand lines of the printk code. Those interested in learning more of the finer details can see the patch series.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week