summaryrefslogtreecommitdiffstats
path: root/Documentation/RCU/whatisRCU.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/RCU/whatisRCU.txt')
-rw-r--r--Documentation/RCU/whatisRCU.txt32
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
562familiar locking primitives. Its overhead makes it a non-starter for 562familiar locking primitives. Its overhead makes it a non-starter for
563real-life use, as does its lack of scalability. It is also unsuitable 563real-life use, as does its lack of scalability. It is also unsuitable
564for realtime use, since it allows scheduling latency to "bleed" from 564for realtime use, since it allows scheduling latency to "bleed" from
565one read-side critical section to another. 565one read-side critical section to another. It also assumes recursive
566reader-writer locks: If you try this with non-recursive locks, and
567you allow nested rcu_read_lock() calls, you can deadlock.
566 568
567However, it is probably the easiest implementation to relate to, so is 569However, it is probably the easiest implementation to relate to, so is
568a good starting point. 570a 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
591missing much. But here they are anyway. And whatever you do, don't 593much. But here are simplified versions anyway. And whatever you do,
592forget about them when submitting patches making use of RCU!] 594don'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
606The rcu_read_lock() and rcu_read_unlock() primitive read-acquire 609The 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
926e. Is your workload too update-intensive for normal use of 929e. 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
930f. Do you need read-side critical sections that are respected 934f. 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