lkml.org 
[lkml]   [2009]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH -mm 5/6] slqb: introduce __kfree_rcu
Introduce __kfree_rcu() for kfree_rcu()

It like __kfree_rcu() in slab.c, slub.c
We can calculate the object poiter from a poiter inside this
object in slqb.c, so we can use it for rcu callback and free
the object.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/mm/slqb.c b/mm/slqb.c
index 48bdf3b..c258ddc 100644
--- a/mm/slqb.c
+++ b/mm/slqb.c
@@ -2482,6 +2484,23 @@ void kfree(const void *object)
}
EXPORT_SYMBOL(kfree);

+static void kfree_rcu_callback(struct rcu_head *rcu)
+{
+ void *portion = rcu;
+ struct slqb_page *page = virt_to_head_slqb_page(portion);
+ struct kmem_cache *s = page->list->cache;
+ unsigned int index = (portion - page->s_mem) / s->size;
+ void *object = page->s_mem + s->size * index;
+
+ slab_free(s, page, object);
+}
+
+void __kfree_rcu(const void *objp, struct rcu_head *rcu)
+{
+ call_rcu(rcu, kfree_rcu_callback);
+}
+EXPORT_SYMBOL(__kfree_rcu);
+
static void kmem_cache_trim_percpu(void *arg)
{
int cpu = smp_processor_id();






\
 
 \ /
  Last update: 2009-03-03 14:51    [W:0.050 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site