Skip to contentSkip to conversation

rcu: introduce kfree_rcu

PATCH In review Lai Jiangshan 2 participants 2 messages Mar 3, 2009 – Mar 23, 2009 Slab allocator

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 rcu: introduce kfree_rcu

__kfree_rcu() in slab layer(slab.c, slob.c, slub.c, slqb.c) is provided. This patch introduce the final kfree_rcu().

Thank Manfred Spraul designed kfree_rcu()'s API.

---

include/linux/slab.h +14 -0
index 24c5602..2a8d5a4 100644
@@ -130,6 +130,20 @@ void kfree(const void *);
 void kzfree(const void *);
 size_t ksize(const void *);
 
+struct rcu_head;
+void __kfree_rcu(const void *, struct rcu_head *);
+
+/**
+ * kfree_rcu - kfree after a grace period
+ * @ptr: pointer to kfree
+ * @rcu_member: name of the struct rcu_head member.
+ *
+ * Many rcu callbacks just call kfree() on the base structure. This helper
+ * function calls kfree internally. The rcu_head structure must be embedded
+ * in the to be freed structure.
+ */
+#define kfree_rcu(ptr, rcu_member)	__kfree_rcu((ptr), &(ptr)->rcu_member)
+
 /*
  * Allocator specific definitions. These are mainly used to establish optimized
  * ways to convert kmalloc() calls to kmem_cache_alloc() invocations by