Linux 6.14 To Perform Better With The Drgn Debugger Via Faster /proc/kcore Reads

Written by Michael Larabel in Linux Kernel on 18 January 2025 at 10:04 AM EST. 4 Comments
LINUX KERNEL
Christian Brauner of Microsoft began sending out his various pull requests today of new material for the Linux 6.14 kernel in advance of the merge window expected to open next week. One of the interesting pull requests is carrying the work of Omar Sandoval for faster /proc/kcore reads that can help with debugger performance.

Back in November I originally brought up the tentative patches at the time around Linux kernel optimizations for speeding-up debuggers reading /proc/kcore. That work has now crossed the finish line and has been submitted for pulling by Linus Torvalds into the Linux 6.14 kernel.

Christian Brauner explains in the pull request:
"The performance of /proc/kcore reads has been showing up as a bottleneck for the drgn debugger. drgn scripts often spend ~25% of their time in the kernel reading from /proc/kcore.

A lot of this overhead comes from silly inefficiencies. This pull request contains fixes for the low-hanging fruit. The fixes are all fairly small and straightforward. The result is a 25% improvement in read latency in micro-benchmarks (from ~235 nanoseconds to ~175) and a 15% improvement in execution time for real-world drgn scripts:

- Make /proc/kcore entry permanent.

- Avoid walking the list on every read.

- Use percpu_rw_semaphore for kclist_lock.

- Make Omar Sandoval the official maintainer for /proc/kcore."

More details via this pull request.

drgn logo


Drgn is the programmable debugger developed by Meta that can allow using Python scripts for debugging the Linux kernel and more. More details on Drgn can be found via the GitHub project site.
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