linux-stable/kernel/rcu
Paul E. McKenney 2da4b2a7fd srcu: Expedite first synchronize_srcu() when idle
Classic SRCU in effect expedites the first synchronize_srcu() when SRCU
is idle, and Mike Galbraith demonstrated that some use cases do in fact
rely on this behavior.  In particular, Mike showed that Steven Rostedt's
hotplug stress script takes 55 seconds with Classic SRCU and more than
16 -minutes- when running Tree SRCU.  Assuming that each Tree SRCU's call
to synchronize_srcu() takes four milliseconds, this implies that Steven's
test invokes synchronize_srcu() in isolation, but more than once per
200 microseconds.  Mike used ftrace to demonstrate that the time between
successive calls to synchronize_srcu() ranged from 118 to 342 microseconds,
with one outlier at 80 milliseconds.  This data clearly indicates that
Tree SRCU needs to expedite the first invocation of synchronize_srcu()
during an SRCU idle period.

This commit therefor introduces a srcu_might_be_idle() function that
probabilistically checks whether or not SRCU is idle.  This function is
used by synchronize_rcu() as an additional criterion in deciding whether
or not to expedite.

(Hat trick to Peter Zijlstra for his earlier suggestion that this might
in fact be a problem.  Which for all I know might have motivated Mike to
look into it.)

Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Mike Galbraith <efault@gmx.de>
2017-04-26 16:32:16 -07:00
..
Makefile srcu: Introduce CLASSIC_SRCU Kconfig option 2017-04-18 11:38:23 -07:00
rcu.h srcu: Merge ->srcu_state into ->srcu_gp_seq 2017-04-18 11:38:22 -07:00
rcuperf.c sched/headers: Prepare for new header dependencies before moving code to <uapi/linux/sched/types.h> 2017-03-02 08:42:27 +01:00
rcutorture.c srcu: Make rcutorture writer stalls print SRCU GP state 2017-04-26 11:23:28 -07:00
srcu.c srcu: Introduce CLASSIC_SRCU Kconfig option 2017-04-18 11:38:23 -07:00
srcutiny.c srcu: Create a tiny SRCU 2017-04-18 11:38:22 -07:00
srcutree.c srcu: Expedite first synchronize_srcu() when idle 2017-04-26 16:32:16 -07:00
sync.c locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write() 2016-08-18 15:36:59 +02:00
tiny.c rcu: Semicolon inside RCU_TRACE() for Tiny RCU 2017-04-18 11:38:17 -07:00
tiny_plugin.h srcu: Allow SRCU to access rcu_scheduler_active 2017-04-18 11:38:18 -07:00
tree.c srcu: Make rcutorture writer stalls print SRCU GP state 2017-04-26 11:23:28 -07:00
tree.h srcu: Parallelize callback handling 2017-04-21 05:59:26 -07:00
tree_exp.h srcu: Improve rcu_seq grace-period-counter abstraction 2017-04-18 11:38:21 -07:00
tree_plugin.h Merge branches 'doc.2017.04.12a', 'fixes.2017.04.19a' and 'srcu.2017.04.21a' into HEAD 2017-04-21 06:00:13 -07:00
tree_trace.c srcu: Move rcu_init_levelspread() to rcu_tree_node.h 2017-04-18 11:38:20 -07:00
update.c rcu: Make non-preemptive schedule be Tasks RCU quiescent state 2017-04-21 05:59:27 -07:00