~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/RCU/rcu.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 .. _rcu_doc:
  2 
  3 RCU Concepts
  4 ============
  5 
  6 The basic idea behind RCU (read-copy update) is to split destructive
  7 operations into two parts, one that prevents anyone from seeing the data
  8 item being destroyed, and one that actually carries out the destruction.
  9 A "grace period" must elapse between the two parts, and this grace period
 10 must be long enough that any readers accessing the item being deleted have
 11 since dropped their references.  For example, an RCU-protected deletion
 12 from a linked list would first remove the item from the list, wait for
 13 a grace period to elapse, then free the element.  See listRCU.rst for more
 14 information on using RCU with linked lists.
 15 
 16 Frequently Asked Questions
 17 --------------------------
 18 
 19 - Why would anyone want to use RCU?
 20 
 21   The advantage of RCU's two-part approach is that RCU readers need
 22   not acquire any locks, perform any atomic instructions, write to
 23   shared memory, or (on CPUs other than Alpha) execute any memory
 24   barriers.  The fact that these operations are quite expensive
 25   on modern CPUs is what gives RCU its performance advantages
 26   in read-mostly situations.  The fact that RCU readers need not
 27   acquire locks can also greatly simplify deadlock-avoidance code.
 28 
 29 - How can the updater tell when a grace period has completed
 30   if the RCU readers give no indication when they are done?
 31 
 32   Just as with spinlocks, RCU readers are not permitted to
 33   block, switch to user-mode execution, or enter the idle loop.
 34   Therefore, as soon as a CPU is seen passing through any of these
 35   three states, we know that that CPU has exited any previous RCU
 36   read-side critical sections.  So, if we remove an item from a
 37   linked list, and then wait until all CPUs have switched context,
 38   executed in user mode, or executed in the idle loop, we can
 39   safely free up that item.
 40 
 41   Preemptible variants of RCU (CONFIG_PREEMPT_RCU) get the
 42   same effect, but require that the readers manipulate CPU-local
 43   counters.  These counters allow limited types of blocking within
 44   RCU read-side critical sections.  SRCU also uses CPU-local
 45   counters, and permits general blocking within RCU read-side
 46   critical sections.  These variants of RCU detect grace periods
 47   by sampling these counters.
 48 
 49 - If I am running on a uniprocessor kernel, which can only do one
 50   thing at a time, why should I wait for a grace period?
 51 
 52   See UP.rst for more information.
 53 
 54 - How can I see where RCU is currently used in the Linux kernel?
 55 
 56   Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu",
 57   "rcu_read_lock_bh", "rcu_read_unlock_bh", "srcu_read_lock",
 58   "srcu_read_unlock", "synchronize_rcu", "synchronize_net",
 59   "synchronize_srcu", and the other RCU primitives.  Or grab one
 60   of the cscope databases from:
 61 
 62   (http://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html).
 63 
 64 - What guidelines should I follow when writing code that uses RCU?
 65 
 66   See checklist.rst.
 67 
 68 - Why the name "RCU"?
 69 
 70   "RCU" stands for "read-copy update".
 71   listRCU.rst has more information on where this name came from, search
 72   for "read-copy update" to find it.
 73 
 74 - I hear that RCU is patented?  What is with that?
 75 
 76   Yes, it is.  There are several known patents related to RCU,
 77   search for the string "Patent" in Documentation/RCU/RTFP.txt to find them.
 78   Of these, one was allowed to lapse by the assignee, and the
 79   others have been contributed to the Linux kernel under GPL.
 80   Many (but not all) have long since expired.
 81   There are now also LGPL implementations of user-level RCU
 82   available (https://liburcu.org/).
 83 
 84 - I hear that RCU needs work in order to support realtime kernels?
 85 
 86   Realtime-friendly RCU are enabled via the CONFIG_PREEMPTION
 87   kernel configuration parameter.
 88 
 89 - Where can I find more information on RCU?
 90 
 91   See the Documentation/RCU/RTFP.txt file.
 92   Or point your browser at (https://docs.google.com/document/d/1X0lThx8OK0ZgLMqVoXiR4ZrGURHrXK6NyLRbeXe3Xac/edit)
 93   or (https://docs.google.com/document/d/1GCdQC8SDbb54W1shjEXqGZ0Rq8a6kIeYutdSIajfpLA/edit?usp=sharing).

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php