Re: [PATCH 03/10] Add the memory allocation/freeing hooks for kmemleak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pekka,

On 11/07/06, Pekka Enberg <[email protected]> wrote:
On 7/11/06, Catalin Marinas <[email protected]> wrote:
> diff --git a/mm/slab.c b/mm/slab.c
> index 85c2e03..2752272 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2967,6 +2967,7 @@ #endif
>                 STATS_INC_ALLOCMISS(cachep);
>                 objp = cache_alloc_refill(cachep, flags);
>         }
> +       memleak_erase(&ac->entry[ac->avail]);
>         return objp;
>  }

Can't we tell the GC not to scan any of the array cache structs? You
could put that in alloc_arraycache(), I think.

Yes, we can. I'll give it a try before updating the patches.

> @@ -3209,7 +3211,11 @@ static void __cache_free(struct kmem_cac
>   */
>  void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
>  {
> -       return __cache_alloc(cachep, flags, __builtin_return_address(0));
> +       void *ptr = __cache_alloc(cachep, flags, __builtin_return_address(0));
> +
> +       memleak_alloc(ptr, obj_size(cachep), 1);

Can you move memleak_alloc() call to __cache_alloc() instead to avoid
duplication?

It might clutter the code because __cache_alloc is used by kmalloc as
well and the exact size information is lost. It would be to
explicitely give the type information to kmemleak in kmalloc and have
memleak_alloc called in __cache_alloc (with slight overhead of calling
kmemleak functions twice). The other option is to pass an extra
argument (guessed typeid) to __cache_alloc but this means adding extra
ifdefs.

Thanks.

--
Catalin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux