[PATCH RFC tip/core/rcu 0/4] Accelerate RCU Tasks Trace updates

From: Paul E. McKenney
Date: Thu Sep 10 2020 - 16:21:37 EST


This series accelerates RCU Tasks Trace updates, reducing the average
grace-period latencies from about a second to about 20 milliseconds
on my x86 laptop. These are benchmark numbers, based on a previously
posted patch to rcuscale.c [1] running on my x86 laptop. The patches
in this series are as follows:

1. Mark variables static, noted during this effort but otherwise
unconnected. This change has no effect, so that the average
grace-period latency remains at 980 milliseconds.

2. Use more aggressive polling for RCU Tasks Trace. This polling
starts at five-millisecond intervals instead of the prior
100-millisecond intervals. As before, the polling interval
increases in duration as the grace period ages, and again as
before is capped at one second. This change reduces the
average grace-period latency to about 620 milliseconds.

3. Selectively enable more RCU Tasks Trace IPIs. This retains
the old behavior of suppressing IPIs for grace periods that are
younger than 500 milliseconds for CONFIG_TASKS_TRACE_RCU_READ_MB=y
kernels, including CONFIG_PREEMPT_RT=y kernels, but allows IPIs
immediately on other kernels. It is quite possible that a more
sophisticated decision procedure will be required, and changes
to RCU's dyntick-idle code might also be needed. This change
(along with the earlier ones) reduces the average grace-period
latency to about 120 milliseconds.

4. Shorten per-grace-period sleep for RCU Tasks Trace. The
current code sleeps for 100 milliseconds after the end of
each grace period, which by itself prevents a back-to-back
string of grace-period waits from completing faster than
ten per second. This patch also retains this old behavior
for CONFIG_TASKS_TRACE_RCU_READ_MB=y (and again thus also
for CONFIG_PREEMPT_RT=y kernels). For other kernels, this
post-grace-period sleep is reduced to five milliseconds.
This change (along with the earlier ones) reduced the average
grace-period latency to about 18 milliseconds, for an overall
factor-of-50 reduction in latency.

Alexei Starovoitov benchmarked an earlier patch [2], producing results
that are roughly consistent with the above reduction in latency [3].

Thanx, Paul

[1] https://lore.kernel.org/bpf/20200909193900.GK29330@paulmck-ThinkPad-P72/
[2] https://lore.kernel.org/bpf/20200910052727.GA4351@paulmck-ThinkPad-P72/
[3] https://lore.kernel.org/bpf/619554b2-4746-635e-22f3-7f0f09d97760@xxxxxx/


tasks.h | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)