Skip to content

Commit 8c8250e

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
doc: Update for SRCU-fast definitions and initialization
This commit documents the DEFINE_SRCU_FAST(), DEFINE_STATIC_SRCU_FAST(), and init_srcu_struct_fast() API members. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: <bpf@vger.kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent ac51c40 commit 8c8250e

3 files changed

Lines changed: 27 additions & 21 deletions

File tree

Documentation/RCU/Design/Requirements/Requirements.rst

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,15 +2637,16 @@ synchronize_srcu() for some other domain ``ss1``, and if an
26372637
that was held across as ``ss``-domain synchronize_srcu(), deadlock
26382638
would again be possible. Such a deadlock cycle could extend across an
26392639
arbitrarily large number of different SRCU domains. Again, with great
2640-
power comes great responsibility.
2640+
power comes great responsibility, though lockdep is now able to detect
2641+
this sort of deadlock.
26412642

2642-
Unlike the other RCU flavors, SRCU read-side critical sections can run
2643-
on idle and even offline CPUs. This ability requires that
2644-
srcu_read_lock() and srcu_read_unlock() contain memory barriers,
2645-
which means that SRCU readers will run a bit slower than would RCU
2646-
readers. It also motivates the smp_mb__after_srcu_read_unlock() API,
2647-
which, in combination with srcu_read_unlock(), guarantees a full
2648-
memory barrier.
2643+
Unlike the other RCU flavors, SRCU read-side critical sections can run on
2644+
idle and even offline CPUs, with the exception of srcu_read_lock_fast()
2645+
and friends. This ability requires that srcu_read_lock() and
2646+
srcu_read_unlock() contain memory barriers, which means that SRCU
2647+
readers will run a bit slower than would RCU readers. It also motivates
2648+
the smp_mb__after_srcu_read_unlock() API, which, in combination with
2649+
srcu_read_unlock(), guarantees a full memory barrier.
26492650

26502651
Also unlike other RCU flavors, synchronize_srcu() may **not** be
26512652
invoked from CPU-hotplug notifiers, due to the fact that SRCU grace
@@ -2681,15 +2682,15 @@ run some tests first. SRCU just might need a few adjustment to deal with
26812682
that sort of load. Of course, your mileage may vary based on the speed
26822683
of your CPUs and the size of your memory.
26832684

2684-
The `SRCU
2685-
API <https://lwn.net/Articles/609973/#RCU%20Per-Flavor%20API%20Table>`__
2685+
The `SRCU API
2686+
<https://lwn.net/Articles/609973/#RCU%20Per-Flavor%20API%20Table>`__
26862687
includes srcu_read_lock(), srcu_read_unlock(),
2687-
srcu_dereference(), srcu_dereference_check(),
2688-
synchronize_srcu(), synchronize_srcu_expedited(),
2689-
call_srcu(), srcu_barrier(), and srcu_read_lock_held(). It
2690-
also includes DEFINE_SRCU(), DEFINE_STATIC_SRCU(), and
2691-
init_srcu_struct() APIs for defining and initializing
2692-
``srcu_struct`` structures.
2688+
srcu_dereference(), srcu_dereference_check(), synchronize_srcu(),
2689+
synchronize_srcu_expedited(), call_srcu(), srcu_barrier(),
2690+
and srcu_read_lock_held(). It also includes DEFINE_SRCU(),
2691+
DEFINE_STATIC_SRCU(), DEFINE_SRCU_FAST(), DEFINE_STATIC_SRCU_FAST(),
2692+
init_srcu_struct(), and init_srcu_struct_fast() APIs for defining and
2693+
initializing ``srcu_struct`` structures.
26932694

26942695
More recently, the SRCU API has added polling interfaces:
26952696

Documentation/RCU/checklist.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,13 @@ over a rather long period of time, but improvements are always welcome!
417417
you should be using RCU rather than SRCU, because RCU is almost
418418
always faster and easier to use than is SRCU.
419419

420-
Also unlike other forms of RCU, explicit initialization and
421-
cleanup is required either at build time via DEFINE_SRCU()
422-
or DEFINE_STATIC_SRCU() or at runtime via init_srcu_struct()
423-
and cleanup_srcu_struct(). These last two are passed a
424-
"struct srcu_struct" that defines the scope of a given
420+
Also unlike other forms of RCU, explicit initialization
421+
and cleanup is required either at build time via
422+
DEFINE_SRCU(), DEFINE_STATIC_SRCU(), DEFINE_SRCU_FAST(),
423+
or DEFINE_STATIC_SRCU_FAST() or at runtime via either
424+
init_srcu_struct() or init_srcu_struct_fast() and
425+
cleanup_srcu_struct(). These last three are passed a
426+
`struct srcu_struct` that defines the scope of a given
425427
SRCU domain. Once initialized, the srcu_struct is passed
426428
to srcu_read_lock(), srcu_read_unlock() synchronize_srcu(),
427429
synchronize_srcu_expedited(), and call_srcu(). A given

Documentation/RCU/whatisRCU.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,10 @@ SRCU: Initialization/cleanup/ordering::
12271227

12281228
DEFINE_SRCU
12291229
DEFINE_STATIC_SRCU
1230+
DEFINE_SRCU_FAST // for srcu_read_lock_fast() and friends
1231+
DEFINE_STATIC_SRCU_FAST // for srcu_read_lock_fast() and friends
12301232
init_srcu_struct
1233+
init_srcu_struct_fast
12311234
cleanup_srcu_struct
12321235
smp_mb__after_srcu_read_unlock
12331236

0 commit comments

Comments
 (0)