Skip to content

Contention reduction for v4.18

Paul E. McKenney lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest21 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21rcu: Improve non-root rcu_cbs_completed() accuracykernel/rcu/tree.c+15 -00 replies
2/21rcu: Make rcu_start_future_gp()'s grace-period check more precisekernel/rcu/tree.c+5 -130 replies
3/21rcu: Add accessor macros for the ->need_future_gp[] arraykernel/rcu/tree.c kernel/rcu/tree.h kernel/rcu/tree_plugin.h+23 -100 replies
4/21rcu: Make rcu_gp_kthread() check for early-boot activitykernel/rcu/tree.c+6 -00 replies
5/21rcu: Make rcu_gp_cleanup() more accurately predict need for new GPkernel/rcu/tree.c kernel/rcu/tree.h kernel/rcu/tree_plugin.h+10 -247 replies
6/21rcu: Avoid losing ->need_future_gp[] values due to GP start/end raceskernel/rcu/tree.h+1 -20 replies
7/21rcu: Make rcu_future_needs_gp() check all ->need_future_gps[] elementskernel/rcu/tree.c kernel/rcu/tree.h+3 -20 replies
8/21rcu: Convert ->need_future_gp[] array to booleankernel/rcu/tree.c kernel/rcu/tree.h+4 -40 replies
9/21rcu: Make rcu_migrate_callbacks wake GP kthread when neededkernel/rcu/tree.c+6 -20 replies
10/21rcu: Avoid __call_rcu_core() root rcu_node ->lock acquisitionkernel/rcu/tree.c+4 -40 replies
11/21rcu: Switch __rcu_process_callbacks() to rcu_accelerate_cbs()kernel/rcu/tree.c+15 -380 replies
12/21rcu: Cleanup, don't put ->completed into an intkernel/rcu/tree.c+1 -10 replies
13/21rcu: Clear request other than RCU_GP_FLAG_INIT at GP endkernel/rcu/tree.c+1 -00 replies
14/21rcu: Inline rcu_start_gp_advanced() into rcu_start_future_gp()kernel/rcu/tree.c+12 -440 replies
15/21rcu: Make rcu_start_future_gp() caller select grace periodkernel/rcu/tree.c kernel/rcu/tree_plugin.h+27 -350 replies
16/21rcu: Add funnel locking to rcu_start_this_gp()kernel/rcu/tree.c+35 -5711 replies
17/21rcu: Make rcu_start_this_gp() check for out-of-range requestskernel/rcu/tree.c+2 -00 replies
18/21rcu: The rcu_gp_cleanup() function does not need cpu_needs_another_gp()kernel/rcu/tree.c+2 -40 replies
19/21rcu: Simplify and inline cpu_needs_another_gp()kernel/rcu/rcu_segcblist.c kernel/rcu/rcu_segcblist.h kernel/rcu/tree.c+3 -570 replies
20/21rcu: Drop early GP request check from rcu_gp_kthread()kernel/rcu/tree.c+0 -60 replies
21/21rcu: Update list of rcu_future_grace_period() trace eventsinclude/trace/events/rcu.h+7 -60 replies

Reviews trailers per patch

None of the 21 patches has a Reviewed-by or Acked-by.

PatchNicholas Piggin
SeriesT-b
1/21
2/21
3/21
4/21
5/21
6/21
7/21
8/21
9/21
10/21
11/21
12/21
13/21
14/21
15/21
16/21
17/21
18/21
19/21
20/21
21/21

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH tip/core/rcu 0/21] Contention reduction for v4.18

Hello!

This series reduces lock contention on the root rcu_node structure, and is also the first precursor to TBD changes to consolidate the three RCU flavors (RCU-bh, RCU-preempt, and RCU-sched) into one.

1. Improve non-root rcu_cbs_completed() accuracy, thus reducing the
need to acquire the root rcu_node structure's ->lock. This also eliminates the need to reassign callbacks to an earlier grace period, which enables introduction of funnel locking in a later commit, which further reduces contention.

2. Make rcu_start_future_gp()'s grace-period check more precise,

	eliminating one need for forward-progress failsafe checks
	that acquire the root rcu_node structure's ->lock.

3. Create (and make use of) accessors for the ->need_future_gp[]
array to enable easy changes in size.

4. Make rcu_gp_kthread() check for early-boot activity, which was
another situation needing failsafe checks.

5. Make rcu_gp_cleanup() more accurately predict need for new GP.
This eliminates the need for both failsafe checks and extra grace-period kthread wakeups.

6. Avoid losing ->need_future_gp[] values due to GP start/end races
by expanding this array from two elements to four.

7. Make rcu_future_needs_gp() check all ->need_future_gps[] elements,
again to eliminate a need for both failsafe checks and extra grace-period kthread wakeups.

8. Convert ->need_future_gp[] array to boolean, given that there
is no longer a need to count the number of requests for a future grace period.

9. Make rcu_migrate_callbacks wake GP kthread when needed, which
again eliminates a need for failsafe checks.

10. Avoid __call_rcu_core() root rcu_node ->lock acquisition, which
was one of the failsafe checks that many of the above patches were making safe to remove.

11. Switch __rcu_process_callbacks() to rcu_accelerate_cbs(), which
was one of the failsafe checks that many of the above patches were making safe to remove. (Yes, this one also acquired the root rcu_node structure's ->lock, and was in fact the lock acquisition that was showing up in Nick Piggin's traces.)

12. Put ->completed into an unsigned long instead of an int. (The
"int" was harmless because only the low-order bits were used, but it was still an accident waiting to happen.)

13. Clear requests other than RCU_GP_FLAG_INIT at grace-period end.
This prevents premature quiescent-state forcing that might otherwise occur due to requests posted when the grace period was already almost done.

14. Inline rcu_start_gp_advanced() into rcu_start_future_gp().
This brings RCU down to only one function to start a grace period, in happen contrast to the need to choose correctly between three of them before this patch series.

15. Make rcu_start_future_gp() caller select grace period to avoid
duplicate grace-period selection. (We are going to like this grace period so much that we selected it twice!)

16. Add funnel locking to rcu_start_this_gp(), the point being to
reduce lock contention, especially on large systems.

17. Make rcu_start_this_gp() check for out-of-range requests.
If this check triggers, that indicates a bug in a caller of rcu_start_this_gp() or that the ->need_future_gp[] array needs to be even bigger, most likely the former. More importantly, it avoids one possible cause of otherwise silent grace-period hangs.

18. The rcu_gp_cleanup() function does not need cpu_needs_another_gp()
because funnel locking summarizes the need for future grace periods in the root rcu_node structure's ->lock, which rcu_gp_cleanup() already holds for other reasons.

19. Simplify and inline cpu_needs_another_gp(), which used to be a key
part of the no-longer-required forward-progress failsafe checks.

20. Drop early GP request check from rcu_gp_kthread(). Yes, it
was added above in order avoid grace-period hangs, but at this point in the series is no longer needed. All in the name of bisectability.

21. Update list of rcu_future_grace_period() trace events to reflect
strings added above.

Thanx, Paul

------------------------------------------------------------------------

 include/trace/events/rcu.h |   13 -
 kernel/rcu/rcu_segcblist.c |   18 -
 kernel/rcu/rcu_segcblist.h |    2 
 kernel/rcu/tree.c          |  406 ++++++++++++++++-----------------------------
 kernel/rcu/tree.h          |   24 ++
 kernel/rcu/tree_plugin.h   |   28 ---
 6 files changed, 182 insertions(+), 309 deletions(-)