Commit 90c73cb2 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Paul E. McKenney
Browse files

docs: RCU: Convert rcuref.txt to ReST



- Add a SPDX header;
- Adjust document title;
- Some whitespace fixes and new line breaks;
- Mark literal blocks as such;
- Add it to RCU/index.rst.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 43cb5451
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ RCU concepts
   whatisRCU
   rcu
   rculist_nulls
   rcuref
   torture
   listRCU
   NMI-RCU
+103 −96
Original line number Diff line number Diff line
Reference-count design for elements of lists/arrays protected by RCU.
.. SPDX-License-Identifier: GPL-2.0

====================================================================
Reference-count design for elements of lists/arrays protected by RCU
====================================================================


Please note that the percpu-ref feature is likely your first
@@ -12,7 +16,8 @@ please read on.
Reference counting on elements of lists which are protected by traditional
reader/writer spinlocks or semaphores are straightforward:

CODE LISTING A:
CODE LISTING A::

    1.					    2.
    add()				    search_and_reference()
    {					    {
@@ -46,7 +51,8 @@ search_and_reference() could potentially hold reference to an element which
has already been deleted from the list/array.  Use atomic_inc_not_zero()
in this scenario as follows:

CODE LISTING B:
CODE LISTING B::

    1.					    2.
    add()				    search_and_reference()
    {					    {
@@ -82,7 +88,8 @@ search_and_reference() code path. In such cases, the
atomic_dec_and_test() may be moved from delete() to el_free()
as follows:

CODE LISTING C:
CODE LISTING C::

    1.					    2.
    add()				    search_and_reference()
    {					    {
@@ -130,7 +137,7 @@ the eventual invocation of kfree(), which is usually not a problem on
modern computer systems, even the small ones.

In cases where delete() can sleep, synchronize_rcu() can be called from
delete(), so that el_free() can be subsumed into delete as follows:
delete(), so that el_free() can be subsumed into delete as follows::

    4.
    delete()