x86: unify a.out{,_32,_64}.h
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / Documentation / RCU / rcu.txt
CommitLineData
1da177e4
LT
1RCU Concepts
2
3
4The basic idea behind RCU (read-copy update) is to split destructive
5operations into two parts, one that prevents anyone from seeing the data
6item being destroyed, and one that actually carries out the destruction.
7A "grace period" must elapse between the two parts, and this grace period
8must be long enough that any readers accessing the item being deleted have
9since dropped their references. For example, an RCU-protected deletion
10from a linked list would first remove the item from the list, wait for
11a grace period to elapse, then free the element. See the listRCU.txt
12file for more information on using RCU with linked lists.
13
14
15Frequently Asked Questions
16
17o Why would anyone want to use RCU?
18
19 The advantage of RCU's two-part approach is that RCU readers need
20 not acquire any locks, perform any atomic instructions, write to
21 shared memory, or (on CPUs other than Alpha) execute any memory
22 barriers. The fact that these operations are quite expensive
23 on modern CPUs is what gives RCU its performance advantages
24 in read-mostly situations. The fact that RCU readers need not
25 acquire locks can also greatly simplify deadlock-avoidance code.
26
27o How can the updater tell when a grace period has completed
28 if the RCU readers give no indication when they are done?
29
30 Just as with spinlocks, RCU readers are not permitted to
31 block, switch to user-mode execution, or enter the idle loop.
32 Therefore, as soon as a CPU is seen passing through any of these
33 three states, we know that that CPU has exited any previous RCU
34 read-side critical sections. So, if we remove an item from a
35 linked list, and then wait until all CPUs have switched context,
36 executed in user mode, or executed in the idle loop, we can
37 safely free up that item.
38
39o If I am running on a uniprocessor kernel, which can only do one
40 thing at a time, why should I wait for a grace period?
41
42 See the UP.txt file in this directory.
43
44o How can I see where RCU is currently used in the Linux kernel?
45
a83f1fe2
PM
46 Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu",
47 "rcu_read_lock_bh", "rcu_read_unlock_bh", "call_rcu_bh",
621934ee
PM
48 "srcu_read_lock", "srcu_read_unlock", "synchronize_rcu",
49 "synchronize_net", and "synchronize_srcu".
1da177e4
LT
50
51o What guidelines should I follow when writing code that uses RCU?
52
53 See the checklist.txt file in this directory.
54
55o Why the name "RCU"?
56
57 "RCU" stands for "read-copy update". The file listRCU.txt has
58 more information on where this name came from, search for
59 "read-copy update" to find it.
60
61o I hear that RCU is patented? What is with that?
62
63 Yes, it is. There are several known patents related to RCU,
64 search for the string "Patent" in RTFP.txt to find them.
65 Of these, one was allowed to lapse by the assignee, and the
66 others have been contributed to the Linux kernel under GPL.
67
dd81eca8
PM
68o I hear that RCU needs work in order to support realtime kernels?
69
70 Yes, work in progress.
71
1da177e4
LT
72o Where can I find more information on RCU?
73
74 See the RTFP.txt file in this directory.
dd81eca8
PM
75 Or point your browser at http://www.rdrop.com/users/paulmck/RCU/.
76
77o What are all these files in this directory?
78
79
80 NMI-RCU.txt
81
82 Describes how to use RCU to implement dynamic
83 NMI handlers, which can be revectored on the fly,
84 without rebooting.
85
86 RTFP.txt
87
88 List of RCU-related publications and web sites.
89
90 UP.txt
91
92 Discussion of RCU usage in UP kernels.
93
94 arrayRCU.txt
95
96 Describes how to use RCU to protect arrays, with
97 resizeable arrays whose elements reference other
98 data structures being of the most interest.
99
100 checklist.txt
101
102 Lists things to check for when inspecting code that
103 uses RCU.
104
105 listRCU.txt
106
107 Describes how to use RCU to protect linked lists.
108 This is the simplest and most common use of RCU
109 in the Linux kernel.
110
111 rcu.txt
112
113 You are reading it!
114
d19720a9
PM
115 rcuref.txt
116
117 Describes how to combine use of reference counts
118 with RCU.
119
dd81eca8
PM
120 whatisRCU.txt
121
122 Overview of how the RCU implementation works. Along
123 the way, presents a conceptual view of RCU.