aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/RCU
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2012-10-19 12:48:30 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2012-11-08 14:44:25 -0500
commit57d34a6cee1399bfedaa73add1915951cbe75cab (patch)
treeb1ace739f62f0e8217b4213a8cdda9fc46f9b27e /Documentation/RCU
parent0f9574d83234274c4d8f8f742b45022e5718b16e (diff)
rcu: Update docs to include kfree_rcu()
Mention kfree_rcu() in the call_rcu() section. Additionally fix the example code for list replacement that used the wrong structure element. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'Documentation/RCU')
-rw-r--r--Documentation/RCU/listRCU.txt2
-rw-r--r--Documentation/RCU/whatisRCU.txt13
2 files changed, 12 insertions, 3 deletions
diff --git a/Documentation/RCU/listRCU.txt b/Documentation/RCU/listRCU.txt
index 4349c1487e91..adb5a3782846 100644
--- a/Documentation/RCU/listRCU.txt
+++ b/Documentation/RCU/listRCU.txt
@@ -205,7 +205,7 @@ RCU ("read-copy update") its name. The RCU code is as follows:
205 audit_copy_rule(&ne->rule, &e->rule); 205 audit_copy_rule(&ne->rule, &e->rule);
206 ne->rule.action = newaction; 206 ne->rule.action = newaction;
207 ne->rule.file_count = newfield_count; 207 ne->rule.file_count = newfield_count;
208 list_replace_rcu(e, ne); 208 list_replace_rcu(&e->list, &ne->list);
209 call_rcu(&e->rcu, audit_free_rule); 209 call_rcu(&e->rcu, audit_free_rule);
210 return 0; 210 return 0;
211 } 211 }
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt
index bf0f6de2aa00..160ac5557e97 100644
--- a/Documentation/RCU/whatisRCU.txt
+++ b/Documentation/RCU/whatisRCU.txt
@@ -499,6 +499,8 @@ The foo_reclaim() function might appear as follows:
499 { 499 {
500 struct foo *fp = container_of(rp, struct foo, rcu); 500 struct foo *fp = container_of(rp, struct foo, rcu);
501 501
502 foo_cleanup(fp->a);
503
502 kfree(fp); 504 kfree(fp);
503 } 505 }
504 506
@@ -521,6 +523,12 @@ o Use call_rcu() -after- removing a data element from an
521 read-side critical sections that might be referencing that 523 read-side critical sections that might be referencing that
522 data item. 524 data item.
523 525
526If the callback for call_rcu() is not doing anything more than calling
527kfree() on the structure, you can use kfree_rcu() instead of call_rcu()
528to avoid having to write your own callback:
529
530 kfree_rcu(old_fp, rcu);
531
524Again, see checklist.txt for additional rules governing the use of RCU. 532Again, see checklist.txt for additional rules governing the use of RCU.
525 533
526 534
@@ -773,8 +781,8 @@ a single atomic update, converting to RCU will require special care.
773 781
774Also, the presence of synchronize_rcu() means that the RCU version of 782Also, the presence of synchronize_rcu() means that the RCU version of
775delete() can now block. If this is a problem, there is a callback-based 783delete() can now block. If this is a problem, there is a callback-based
776mechanism that never blocks, namely call_rcu(), that can be used in 784mechanism that never blocks, namely call_rcu() or kfree_rcu(), that can
777place of synchronize_rcu(). 785be used in place of synchronize_rcu().
778 786
779 787
7807. FULL LIST OF RCU APIs 7887. FULL LIST OF RCU APIs
@@ -813,6 +821,7 @@ RCU: Critical sections Grace period Barrier
813 rcu_read_unlock synchronize_rcu 821 rcu_read_unlock synchronize_rcu
814 rcu_dereference synchronize_rcu_expedited 822 rcu_dereference synchronize_rcu_expedited
815 call_rcu 823 call_rcu
824 kfree_rcu
816 825
817 826
818bh: Critical sections Grace period Barrier 827bh: Critical sections Grace period Barrier