[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84144f020807110149v4806404fjdb9c3e4af3cfdb70@mail.gmail.com>
Date: Fri, 11 Jul 2008 11:49:27 +0300
From: "Pekka Enberg" <penberg@...helsinki.fi>
To: "Eduard - Gabriel Munteanu" <eduard.munteanu@...ux360.ro>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
"Christoph Lameter" <cl@...ux-foundation.org>
Subject: Re: [RFC PATCH 3/5] kmemtrace: SLAB hooks.
Hi Eduard-Gabriel,
On Thu, Jul 10, 2008 at 9:06 PM, Eduard - Gabriel Munteanu
<eduard.munteanu@...ux360.ro> wrote:
> This adds hooks for the SLAB allocator, to allow tracing with kmemtrace.
>
> Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>
> static inline void *kmalloc(size_t size, gfp_t flags)
> {
> + void *ret;
> +
> if (__builtin_constant_p(size)) {
> int i = 0;
>
> @@ -50,10 +53,17 @@ static inline void *kmalloc(size_t size, gfp_t flags)
> found:
> #ifdef CONFIG_ZONE_DMA
> if (flags & GFP_DMA)
> - return kmem_cache_alloc(malloc_sizes[i].cs_dmacachep,
> - flags);
> + ret = kmem_cache_alloc(malloc_sizes[i].cs_dmacachep,
> + flags | __GFP_NOTRACE);
> + else
> #endif
> - return kmem_cache_alloc(malloc_sizes[i].cs_cachep, flags);
> + ret = kmem_cache_alloc(malloc_sizes[i].cs_cachep,
> + flags | __GFP_NOTRACE);
> +
> + kmemtrace_mark_alloc(KMEMTRACE_KIND_KERNEL, _THIS_IP_, ret,
> + size, malloc_sizes[i].cs_size, flags);
> +
> + return ret;
I think this would be cleaner if you'd simply add a new
__kmem_cache_alloc() entry point in SLAB that takes the "kind" as an
argument. That way you wouldn't have to play tricks with GFP flags.
--
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