Linux 6.10 Goes Ahead In Removing Sysctl Sentinel Bloat

Written by Michael Larabel in Linux Kernel on 7 May 2024 at 06:32 AM EDT. 10 Comments
LINUX KERNEL
Over the past year there's been much work happening within the Linux kernel's sysctl code for clearing up ~64 bytes of bloat per array throughout the kernel by dropping the last sysctl "sentinel" entry at the end of each array. This also helps in reducing the build time of the kernel and is a nice improvement. With Linux 6.10, the sysctl sentinel clearing throughout different subsystems is set to happen.

Clearing out the the last empty element on each sysctl array is finally happening. For example, the sysctl sentinel removal in the networking subsystem was queued this past week.

Clearing the sentinel


That merge goes on to summarize:
Why?
By removing the sysctl sentinel elements we avoid kernel bloat as ctl_table arrays get moved out of kernel/sysctl.c into their own
respective subsystems. This move was started long ago to avoid merge conflicts; the sentinel removal bit came after Mathew Wilcox suggested it to avoid bloating the kernel by one element as arrays moved out. This patchset will reduce the overall build time size of the kernel and run time memory bloat by about ~64 bytes per declared ctl_table array.
...
Savings in vmlinux:
A total of 64 bytes per sentinel is saved after removal; I measured in x86_64 to give an idea of the aggregated savings. The actual savings will depend on individual kernel configuration.
* bloat-o-meter
- The "yesall" config saves 3976 bytes
- A reduced config saves 1263 bytes

Savings in allocated memory:
None in this set but will occur when the superfluous allocations are removed from proc_sysctl.c. I include it here for context. The estimated savings during boot for config are 6272 bytes.

Nice to see this sysctl sentinel clearing work culminating after the lengthy effort over the past year.
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