diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-02 01:12:54 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-02 01:12:54 -0500 |
commit | 18ee3610040a4c008ce08a40a5dd025241cc7e97 (patch) | |
tree | 32a996a5123726b63c31a1522f230933fb967a32 /Documentation/RCU/whatisRCU.txt | |
parent | e4e7b89280d1d666e2c09e5ad36cf071796c4c7e (diff) | |
parent | b4103333d7904310d34de18d85e51e3d74f00a3b (diff) |
Merge branch 'master'
Diffstat (limited to 'Documentation/RCU/whatisRCU.txt')
-rw-r--r-- | Documentation/RCU/whatisRCU.txt | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index 15da16861fa3..5ed85af88789 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt | |||
@@ -200,10 +200,11 @@ rcu_assign_pointer() | |||
200 | the new value, and also executes any memory-barrier instructions | 200 | the new value, and also executes any memory-barrier instructions |
201 | required for a given CPU architecture. | 201 | required for a given CPU architecture. |
202 | 202 | ||
203 | Perhaps more important, it serves to document which pointers | 203 | Perhaps just as important, it serves to document (1) which |
204 | are protected by RCU. That said, rcu_assign_pointer() is most | 204 | pointers are protected by RCU and (2) the point at which a |
205 | frequently used indirectly, via the _rcu list-manipulation | 205 | given structure becomes accessible to other CPUs. That said, |
206 | primitives such as list_add_rcu(). | 206 | rcu_assign_pointer() is most frequently used indirectly, via |
207 | the _rcu list-manipulation primitives such as list_add_rcu(). | ||
207 | 208 | ||
208 | rcu_dereference() | 209 | rcu_dereference() |
209 | 210 | ||
@@ -258,9 +259,11 @@ rcu_dereference() | |||
258 | locking. | 259 | locking. |
259 | 260 | ||
260 | As with rcu_assign_pointer(), an important function of | 261 | As with rcu_assign_pointer(), an important function of |
261 | rcu_dereference() is to document which pointers are protected | 262 | rcu_dereference() is to document which pointers are protected by |
262 | by RCU. And, again like rcu_assign_pointer(), rcu_dereference() | 263 | RCU, in particular, flagging a pointer that is subject to changing |
263 | is typically used indirectly, via the _rcu list-manipulation | 264 | at any time, including immediately after the rcu_dereference(). |
265 | And, again like rcu_assign_pointer(), rcu_dereference() is | ||
266 | typically used indirectly, via the _rcu list-manipulation | ||
264 | primitives, such as list_for_each_entry_rcu(). | 267 | primitives, such as list_for_each_entry_rcu(). |
265 | 268 | ||
266 | The following diagram shows how each API communicates among the | 269 | The following diagram shows how each API communicates among the |
@@ -327,7 +330,7 @@ for specialized uses, but are relatively uncommon. | |||
327 | 3. WHAT ARE SOME EXAMPLE USES OF CORE RCU API? | 330 | 3. WHAT ARE SOME EXAMPLE USES OF CORE RCU API? |
328 | 331 | ||
329 | This section shows a simple use of the core RCU API to protect a | 332 | This section shows a simple use of the core RCU API to protect a |
330 | global pointer to a dynamically allocated structure. More typical | 333 | global pointer to a dynamically allocated structure. More-typical |
331 | uses of RCU may be found in listRCU.txt, arrayRCU.txt, and NMI-RCU.txt. | 334 | uses of RCU may be found in listRCU.txt, arrayRCU.txt, and NMI-RCU.txt. |
332 | 335 | ||
333 | struct foo { | 336 | struct foo { |
@@ -410,6 +413,8 @@ o Use synchronize_rcu() -after- removing a data element from an | |||
410 | data item. | 413 | data item. |
411 | 414 | ||
412 | See checklist.txt for additional rules to follow when using RCU. | 415 | See checklist.txt for additional rules to follow when using RCU. |
416 | And again, more-typical uses of RCU may be found in listRCU.txt, | ||
417 | arrayRCU.txt, and NMI-RCU.txt. | ||
413 | 418 | ||
414 | 419 | ||
415 | 4. WHAT IF MY UPDATING THREAD CANNOT BLOCK? | 420 | 4. WHAT IF MY UPDATING THREAD CANNOT BLOCK? |
@@ -513,7 +518,7 @@ production-quality implementation, and see: | |||
513 | 518 | ||
514 | for papers describing the Linux kernel RCU implementation. The OLS'01 | 519 | for papers describing the Linux kernel RCU implementation. The OLS'01 |
515 | and OLS'02 papers are a good introduction, and the dissertation provides | 520 | and OLS'02 papers are a good introduction, and the dissertation provides |
516 | more details on the current implementation. | 521 | more details on the current implementation as of early 2004. |
517 | 522 | ||
518 | 523 | ||
519 | 5A. "TOY" IMPLEMENTATION #1: LOCKING | 524 | 5A. "TOY" IMPLEMENTATION #1: LOCKING |
@@ -768,7 +773,6 @@ RCU pointer/list traversal: | |||
768 | rcu_dereference | 773 | rcu_dereference |
769 | list_for_each_rcu (to be deprecated in favor of | 774 | list_for_each_rcu (to be deprecated in favor of |
770 | list_for_each_entry_rcu) | 775 | list_for_each_entry_rcu) |
771 | list_for_each_safe_rcu (deprecated, not used) | ||
772 | list_for_each_entry_rcu | 776 | list_for_each_entry_rcu |
773 | list_for_each_continue_rcu (to be deprecated in favor of new | 777 | list_for_each_continue_rcu (to be deprecated in favor of new |
774 | list_for_each_entry_continue_rcu) | 778 | list_for_each_entry_continue_rcu) |
@@ -807,7 +811,8 @@ Quick Quiz #1: Why is this argument naive? How could a deadlock | |||
807 | Answer: Consider the following sequence of events: | 811 | Answer: Consider the following sequence of events: |
808 | 812 | ||
809 | 1. CPU 0 acquires some unrelated lock, call it | 813 | 1. CPU 0 acquires some unrelated lock, call it |
810 | "problematic_lock". | 814 | "problematic_lock", disabling irq via |
815 | spin_lock_irqsave(). | ||
811 | 816 | ||
812 | 2. CPU 1 enters synchronize_rcu(), write-acquiring | 817 | 2. CPU 1 enters synchronize_rcu(), write-acquiring |
813 | rcu_gp_mutex. | 818 | rcu_gp_mutex. |
@@ -894,7 +899,7 @@ Answer: Just as PREEMPT_RT permits preemption of spinlock | |||
894 | ACKNOWLEDGEMENTS | 899 | ACKNOWLEDGEMENTS |
895 | 900 | ||
896 | My thanks to the people who helped make this human-readable, including | 901 | My thanks to the people who helped make this human-readable, including |
897 | Jon Walpole, Josh Triplett, Serge Hallyn, and Suzanne Wood. | 902 | Jon Walpole, Josh Triplett, Serge Hallyn, Suzanne Wood, and Alan Stern. |
898 | 903 | ||
899 | 904 | ||
900 | For more information, see http://www.rdrop.com/users/paulmck/RCU. | 905 | For more information, see http://www.rdrop.com/users/paulmck/RCU. |