[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1237794899.6313.28.camel@penberg-laptop>
Date: Mon, 23 Mar 2009 09:54:59 +0200
From: Pekka Enberg <penberg@...helsinki.fi>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux-foundation.org>,
Nick Piggin <npiggin@...e.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Manfred Spraul <manfred@...orfullife.com>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -mm 5/6] slqb: introduce __kfree_rcu
On Tue, 2009-03-03 at 21:44 +0800, Lai Jiangshan wrote:
> 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@...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;
Basically the same nit as with the other patches as well: please
separate variable declarations from the initializations for readability.
> +
> + 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();
>
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists