Commit e6d6989
Remove AtFork handling logic from RCU
Summary:
folly RCU currently has a somewhat awkward restriction that there may be no RCU
readers across a fork() call, and that after fork() has been invoked, no AtFork
handlers may enter a read region *unless* they spawn a separate thread in the
AtFork handler. In the child's fork() handler, we then reset the forked child
thread's TLS read counters, and even have a ForkTest that validates that if we
were in a read region while calling fork(), that the child's state is wiped out.
The fact that we zero out the forked child thread's readers rather than
explicitly just panicking is very confusing, and does not match the advertised
behavior of the RCU subsystem. The only thing that's really valid to do in if
fork() is involved is:
1. Have a single threaded program that is not in a read region.
2. Have a single threaded program that is in a read region, and immediately
invokes exec().
These restrictions are common to most librcu implementations. For folly RCU, we
can't do anything to verify that the program was single threaded when we get to
an AtFork handler, and we also can't check that if the caller is in a read
region that they will soon exec(). What we definitely should *not* do is
instill some artificial state of clearing out the read region of the forking
thread on a fork() invocation. This change therefore just removes the folly
AtFork handling logic.
Reviewed By: paulmckrcu
Differential Revision: D35557080
fbshipit-source-id: 77e3bdaaea078c60e7f7c562228de08635f164e61 parent 10ad62a commit e6d6989
File tree
4 files changed
+20
-39
lines changed- folly/synchronization
- detail
- test
4 files changed
+20
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 31 | | |
51 | 32 | | |
52 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
191 | 200 | | |
192 | 201 | | |
193 | 202 | | |
| |||
328 | 337 | | |
329 | 338 | | |
330 | 339 | | |
331 | | - | |
332 | 340 | | |
333 | 341 | | |
334 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | 189 | | |
201 | 190 | | |
202 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | | - | |
204 | | - | |
205 | | - | |
| 204 | + | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | 209 | | |
211 | | - | |
212 | | - | |
| 210 | + | |
| 211 | + | |
213 | 212 | | |
214 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| |||
0 commit comments