]> Pileus Git - ~andy/linux/blobdiff - Documentation/RCU/whatisRCU.txt
rcu: Update docs to include kfree_rcu()
[~andy/linux] / Documentation / RCU / whatisRCU.txt
index bf0f6de2aa00c8d6ee482890bc2bd05434b772c2..160ac5557e97f19d2126312d380a5eae4d05b9f9 100644 (file)
@@ -499,6 +499,8 @@ The foo_reclaim() function might appear as follows:
        {
                struct foo *fp = container_of(rp, struct foo, rcu);
 
+               foo_cleanup(fp->a);
+
                kfree(fp);
        }
 
@@ -521,6 +523,12 @@ o  Use call_rcu() -after- removing a data element from an
        read-side critical sections that might be referencing that
        data item.
 
+If the callback for call_rcu() is not doing anything more than calling
+kfree() on the structure, you can use kfree_rcu() instead of call_rcu()
+to avoid having to write your own callback:
+
+       kfree_rcu(old_fp, rcu);
+
 Again, see checklist.txt for additional rules governing the use of RCU.
 
 
@@ -773,8 +781,8 @@ a single atomic update, converting to RCU will require special care.
 
 Also, the presence of synchronize_rcu() means that the RCU version of
 delete() can now block.  If this is a problem, there is a callback-based
-mechanism that never blocks, namely call_rcu(), that can be used in
-place of synchronize_rcu().
+mechanism that never blocks, namely call_rcu() or kfree_rcu(), that can
+be used in place of synchronize_rcu().
 
 
 7.  FULL LIST OF RCU APIs
@@ -813,6 +821,7 @@ RCU:        Critical sections       Grace period            Barrier
        rcu_read_unlock         synchronize_rcu
        rcu_dereference         synchronize_rcu_expedited
                                call_rcu
+                               kfree_rcu
 
 
 bh:    Critical sections       Grace period            Barrier