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: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-04-21 19:04:07 +02:00 committed by Paul E. McKenney
parent 43cb5451df
commit 90c73cb2c6
2 changed files with 101 additions and 93 deletions

View File

@ -18,6 +18,7 @@ RCU concepts
whatisRCU
rcu
rculist_nulls
rcuref
torture
listRCU
NMI-RCU

View File

@ -1,4 +1,8 @@
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()