@@ -38,7 +38,7 @@ by having call_rcu() directly invoke its arguments only if it was called
38
38
from process context. However, this can fail in a similar manner.
39
39
40
40
Suppose that an RCU-based algorithm again scans a linked list containing
41
- elements A, B, and C in process contexts , but that it invokes a function
41
+ elements A, B, and C in process context , but that it invokes a function
42
42
on each element as it is scanned. Suppose further that this function
43
43
deletes element B from the list, then passes it to call_rcu() for deferred
44
44
freeing. This may be a bit unconventional, but it is perfectly legal
@@ -59,7 +59,8 @@ Example 3: Death by Deadlock
59
59
Suppose that call_rcu() is invoked while holding a lock, and that the
60
60
callback function must acquire this same lock. In this case, if
61
61
call_rcu() were to directly invoke the callback, the result would
62
- be self-deadlock.
62
+ be self-deadlock *even if * this invocation occurred from a later
63
+ call_rcu() invocation a full grace period later.
63
64
64
65
In some cases, it would possible to restructure to code so that
65
66
the call_rcu() is delayed until after the lock is released. However,
@@ -85,6 +86,14 @@ Quick Quiz #2:
85
86
86
87
:ref: `Answers to Quick Quiz <answer_quick_quiz_up >`
87
88
89
+ It is important to note that userspace RCU implementations *do *
90
+ permit call_rcu() to directly invoke callbacks, but only if a full
91
+ grace period has elapsed since those callbacks were queued. This is
92
+ the case because some userspace environments are extremely constrained.
93
+ Nevertheless, people writing userspace RCU implementations are strongly
94
+ encouraged to avoid invoking callbacks from call_rcu(), thus obtaining
95
+ the deadlock-avoidance benefits called out above.
96
+
88
97
Summary
89
98
-------
90
99
0 commit comments