diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-01-24 01:35:45 -0500 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-03-04 11:05:25 -0500 |
| commit | fea651267e52a88e7b81e01b6717d968254b6ddb (patch) | |
| tree | e8dd6001a6c6aba5d747fe7fdee5b91fd13a4246 | |
| parent | 37743de384951ef97c040e69039820c987849501 (diff) | |
rcu: add documentation saying which RCU flavor to choose
Reported-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
| -rw-r--r-- | Documentation/RCU/whatisRCU.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index cfaac34c4557..6ef692667e2f 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt | |||
| @@ -849,6 +849,37 @@ All: lockdep-checked RCU-protected pointer access | |||
| 849 | See the comment headers in the source code (or the docbook generated | 849 | See the comment headers in the source code (or the docbook generated |
| 850 | from them) for more information. | 850 | from them) for more information. |
| 851 | 851 | ||
| 852 | However, given that there are no fewer than four families of RCU APIs | ||
| 853 | in the Linux kernel, how do you choose which one to use? The following | ||
| 854 | list can be helpful: | ||
| 855 | |||
| 856 | a. Will readers need to block? If so, you need SRCU. | ||
| 857 | |||
| 858 | b. What about the -rt patchset? If readers would need to block | ||
| 859 | in an non-rt kernel, you need SRCU. If readers would block | ||
| 860 | in a -rt kernel, but not in a non-rt kernel, SRCU is not | ||
| 861 | necessary. | ||
| 862 | |||
| 863 | c. Do you need to treat NMI handlers, hardirq handlers, | ||
| 864 | and code segments with preemption disabled (whether | ||
| 865 | via preempt_disable(), local_irq_save(), local_bh_disable(), | ||
| 866 | or some other mechanism) as if they were explicit RCU readers? | ||
| 867 | If so, you need RCU-sched. | ||
| 868 | |||
| 869 | d. Do you need RCU grace periods to complete even in the face | ||
| 870 | of softirq monopolization of one or more of the CPUs? For | ||
| 871 | example, is your code subject to network-based denial-of-service | ||
| 872 | attacks? If so, you need RCU-bh. | ||
| 873 | |||
| 874 | e. Is your workload too update-intensive for normal use of | ||
| 875 | RCU, but inappropriate for other synchronization mechanisms? | ||
| 876 | If so, consider SLAB_DESTROY_BY_RCU. But please be careful! | ||
| 877 | |||
| 878 | f. Otherwise, use RCU. | ||
| 879 | |||
| 880 | Of course, this all assumes that you have determined that RCU is in fact | ||
| 881 | the right tool for your job. | ||
| 882 | |||
| 852 | 883 | ||
| 853 | 8. ANSWERS TO QUICK QUIZZES | 884 | 8. ANSWERS TO QUICK QUIZZES |
| 854 | 885 | ||
