Re: [PATCH 2.6.20-rc1 00/10] Kernel memory leak detector 0.13

From: Ingo Molnar
Date: Mon Dec 18 2006 - 14:58:30 EST



* Catalin Marinas <catalin.marinas@xxxxxxxxx> wrote:

> >at freeing we only have to look up the tree belonging to object->cpu.
>
> At freeing, kmemleak only gets a pointer value which has to be looked
> up in the hash table for the corresponding memleak_object. Only after
> that, we can know memleak_object->cpu. That's why I think we only need
> to have a global hash table. The hash table look-up can be RCU.
>
> It would work with per-CPU hash tables but we still need to look-up
> the other hash tables in case the freeing happened on a different CPU
> (i.e. look-up the current hash table and, if it fails, look-up the
> other per-CPU hashes). Freeing would need to remove the entry from the
> hash table and acquire a lock but this would be per-CPU. I'm not sure
> how often you get this scenario (allocation and freeing on different
> CPUs) but it might introduce an overhead to the memory freeing.
>
> Do you have a better solution here?

hmm ... nasty. Would it be feasible to embedd the memleak info into the
allocated object itself? That would remove quite some runtime overhead,
besides eliminating the global hash.

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