Linux 5.10 Will Have A Fully Lock-Less Ring Buffer

From LinuxReviews
Jump to navigationJump to search
Tux-000d-200.png

Linus Torvalds has merged a set of printk() patches by John Ogness that make the kernel ring buffer (what you see if you type dmesg) fully lock-less. This is a big improvement that allows messages to be stored and read without the need for temporary per-CPU buffers with no risk of deadlocks.

written by 林慧 (Wai Lin) 2020-10-17 - last edited 2020-10-24. © CC BY


Video Copyright 2019 John Ogness / Linux Plumbers Conference 2019. Licensed under the Creative Commons Attribution (CC BY) license. Slides: Lpc2019 jogness printk.pdf

The ring buffer is a central part of the Linux kernel. Drivers, sub-systems and a wide range of functionality use printk() to to share errors and general messages about what's going on. You can see its contents by typing dmesg or sudo dmesg in a terminal.

John Ogness gave a 57 minute long video titled "Why is printk() so complicated?" detailing the history of the Linux kernel's ring buffer since Linux 0.01 (Linux-0.01.tar.gz) was released in 1991 to 2019 at the 2019 Linux Plumbers Conference. He pointed out the problems with the long-used printk() implementation and proposed a set of ideas for improving printk() and the kernel's ring buffer functionality at that conference. Some of of his work has now been merged to the Linux git tree, ensuring that it will be a part of Linux 5.10 when it gets released in a few months' time.

Linus Torvalds has merged the first in a series of patches written by John Ogness in order to make printk() more modern, secure and functional.

"The big new thing is the fully lockless ringbuffer implementation, including the support for continuous lines. It will allow to store and read messages in any situation wihtout the risk of deadlocks and without the need of temporary per-CPU buffers.

The access is still serialized by logbuf_lock. It synchronizes few more operations, for example, temporary buffer for formatting the message, syslog and kmsg_dump operations. The lock removal is being discussed and should be ready for the next release."

Petr Mladek, kernel maintainer

The remaining use of logbuf_lock will be addressed when Linux 5.10 is released and the Linux 5.11 merge window opens up around Christmas-time.


5.00
(one vote)


avatar

Vu

14 months ago
Score 0++
methinks this insanity is unstoppable.
Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.