diff options
Diffstat (limited to 'Documentation/RCU/whatisRCU.txt')
-rw-r--r-- | Documentation/RCU/whatisRCU.txt | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index 5cbd8b2395b8..8ed6c9f6133c 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt | |||
@@ -562,7 +562,9 @@ This section presents a "toy" RCU implementation that is based on | |||
562 | familiar locking primitives. Its overhead makes it a non-starter for | 562 | familiar locking primitives. Its overhead makes it a non-starter for |
563 | real-life use, as does its lack of scalability. It is also unsuitable | 563 | real-life use, as does its lack of scalability. It is also unsuitable |
564 | for realtime use, since it allows scheduling latency to "bleed" from | 564 | for realtime use, since it allows scheduling latency to "bleed" from |
565 | one read-side critical section to another. | 565 | one read-side critical section to another. It also assumes recursive |
566 | reader-writer locks: If you try this with non-recursive locks, and | ||
567 | you allow nested rcu_read_lock() calls, you can deadlock. | ||
566 | 568 | ||
567 | However, it is probably the easiest implementation to relate to, so is | 569 | However, it is probably the easiest implementation to relate to, so is |
568 | a good starting point. | 570 | a good starting point. |
@@ -587,20 +589,21 @@ It is extremely simple: | |||
587 | write_unlock(&rcu_gp_mutex); | 589 | write_unlock(&rcu_gp_mutex); |
588 | } | 590 | } |
589 | 591 | ||
590 | [You can ignore rcu_assign_pointer() and rcu_dereference() without | 592 | [You can ignore rcu_assign_pointer() and rcu_dereference() without missing |
591 | missing much. But here they are anyway. And whatever you do, don't | 593 | much. But here are simplified versions anyway. And whatever you do, |
592 | forget about them when submitting patches making use of RCU!] | 594 | don't forget about them when submitting patches making use of RCU!] |
593 | 595 | ||
594 | #define rcu_assign_pointer(p, v) ({ \ | 596 | #define rcu_assign_pointer(p, v) \ |
595 | smp_wmb(); \ | 597 | ({ \ |
596 | (p) = (v); \ | 598 | smp_store_release(&(p), (v)); \ |
597 | }) | 599 | }) |
598 | 600 | ||
599 | #define rcu_dereference(p) ({ \ | 601 | #define rcu_dereference(p) \ |
600 | typeof(p) _________p1 = p; \ | 602 | ({ \ |
601 | smp_read_barrier_depends(); \ | 603 | typeof(p) _________p1 = p; \ |
602 | (_________p1); \ | 604 | smp_read_barrier_depends(); \ |
603 | }) | 605 | (_________p1); \ |
606 | }) | ||
604 | 607 | ||
605 | 608 | ||
606 | The rcu_read_lock() and rcu_read_unlock() primitive read-acquire | 609 | The rcu_read_lock() and rcu_read_unlock() primitive read-acquire |
@@ -925,7 +928,8 @@ d. Do you need RCU grace periods to complete even in the face | |||
925 | 928 | ||
926 | e. Is your workload too update-intensive for normal use of | 929 | e. Is your workload too update-intensive for normal use of |
927 | RCU, but inappropriate for other synchronization mechanisms? | 930 | RCU, but inappropriate for other synchronization mechanisms? |
928 | If so, consider SLAB_DESTROY_BY_RCU. But please be careful! | 931 | If so, consider SLAB_TYPESAFE_BY_RCU (which was originally |
932 | named SLAB_DESTROY_BY_RCU). But please be careful! | ||
929 | 933 | ||
930 | f. Do you need read-side critical sections that are respected | 934 | f. Do you need read-side critical sections that are respected |
931 | even though they are in the middle of the idle loop, during | 935 | even though they are in the middle of the idle loop, during |