Chapter 29. Improving CPU performance by using RCU callbacks
The Read-Copy-Update (RCU) system is a lockless mechanism for mutual exclusion of threads inside the kernel. As a consequence of performing RCU operations, call-backs are sometimes queued on CPUs to be performed at a future moment when removing memory is safe.
To improve CPU performance using RCU callbacks:
- You can remove CPUs from being candidates for running CPU callbacks.
- You can assign a CPU to handle all RCU callbacks. This CPU is called the housekeeping CPU.
- You can relieve CPUs from the responsibility of awakening RCU offload threads.
This combination reduces the interference on CPUs that are dedicated for the user’s workload.
Prerequisites
- You have administrator privileges.
-
The
tunapackage is installed
29.1. Offloading RCU callbacks Copy linkLink copied to clipboard!
You can offload RCU callbacks using the rcu_nocbs and rcu_nocb_poll kernel parameters.
Procedure
To remove one or more CPUs from the candidates for running RCU callbacks, specify the list of CPUs in the
rcu_nocbskernel parameter, for example:rcu_nocbs=1,4-6
rcu_nocbs=1,4-6Copy to Clipboard Copied! Toggle word wrap Toggle overflow or
rcu_nocbs=3
rcu_nocbs=3Copy to Clipboard Copied! Toggle word wrap Toggle overflow The second example instructs the kernel that CPU 3 is a no-callback CPU. This means that RCU callbacks will not be done in the
rcuc/$CPUthread pinned to CPU 3, but in thercuo/$CPUthread. You can move this trhead to a housekeeping CPU to relieve CPU 3 from being assigned RCU callback jobs.
29.2. Moving RCU callbacks Copy linkLink copied to clipboard!
You can assign a housekeeping CPU to handle all RCU callback threads. To do this, use the tuna command and move all RCU callbacks to the housekeeping CPU.
Procedure
Move RCU callback threads to the housekeeping CPU:
tuna --threads=rcu --cpus=x --move
# tuna --threads=rcu --cpus=x --moveCopy to Clipboard Copied! Toggle word wrap Toggle overflow where
xis the CPU number of the housekeeping CPU.
This action relieves all CPUs other than CPU X from handling RCU callback threads.
29.3. Relieving CPUs from awakening RCU offload threads Copy linkLink copied to clipboard!
Although the RCU offload threads can perform the RCU callbacks on another CPU, each CPU is responsible for awakening the corresponding RCU offload thread. You can relieve a CPU from this responsibility,
Procedure
Set the
rcu_nocb_pollkernel parameter.This command causes a timer to periodically raise the RCU offload threads to check if there are callbacks to run.