RCU expedited mode
Description
You can use RCU expedited mode to reduce latencies when rcu_barrier() is called during startup.
Normally, RCU waits until multiple rcu_barriers have accumulated before servicing them. This is done to reduce the runtime overhead of processing this operations while a system is running. However, in expedited mode, the kernel will process the held rcu operations immediately. This incurs possible more total overhead for these RCU operations, but makes the system run faster. This is appropriate when trying to boot quickly.
After expedited mode is used during boot, by setting some options on the kernel command line, RCU is then put back into normal mode for regular runtime operation of the system.
How to implement or use
Add the following items to the kernel command line:
rcupdate.rcu_normal_after_boot=0 rcupdate.rcu_expedited=1
Once the system is fully booted, execute the following:
echo 1 > /sys/kernel/rcu_normal
This can be done by adding a unit file to systemd, or adding an init script in a "SYSV init"-based system. Make sure that the unit file or script is executed after the critical phase of booting is finished.
Expected Improvement
Need to fill in average savings from using this technique
Resources
Examples
RedHat uses this in an automotive distribution of Linux, here: https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/commit/40ecacca333eb75d8e40fb15ed7a544be18ade43
Here is the systemd unit file that they used to reset the system to rcu_normal mode:
[Unit] Description=Disable expedited rcu updates Requires=boot-complete.target After=boot-complete.target [Service] Type=oneshot ExecStart=/usr/bin/echo 1 StandardOutput=file:/sys/kernel/rcu_normal [Install] WantedBy=default.target
Projects
None
Specifications
I'm not sure if this is related to RCU Expedited Grace Periods or not.
Documentation
See https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html (search for rcupdate)
and https://lwn.net/Articles/777214/ for descriptions of rcupdate.rcu_expedited and rcupdate.rcu_normal_after_boot
The technique is mentioned in this presentation: https://pretalx.com/media/devconf-us-2024/submissions/HXVPHC/resources/Accelerating_Linux_Boot_Time__Techniques_an_jjA5HNE.pdf
Patches
None
Case Studies
Case 1
| Hardware | hardware description |
|---|---|
| Kernel Version | put kernel version here |
| Configuration | list relevant kernel config options here |
| Time without using technique | xxxxxxx usec |
| Time using the technique | xxxxxxx usec |
| Time savings | mmm milliseconds |
| Submitter | name and company of submitter |