]> git.karo-electronics.de Git - karo-tx-linux.git/commit
sh: unwinder: Fix memory leak and create our own kmem cache
authorMatt Fleming <matt@console-pimps.org>
Sun, 16 Aug 2009 14:44:08 +0000 (15:44 +0100)
committerMatt Fleming <matt@console-pimps.org>
Fri, 21 Aug 2009 12:02:43 +0000 (13:02 +0100)
commitfb3f3e7fc6d4afb32f9eba32124beaf40313de3c
tree69ed6cfbc123a188aabbe4a98209c935680c27a2
parent97f361e2498ada54b48a235619eaf5af8e46427e
sh: unwinder: Fix memory leak and create our own kmem cache

Plug a memory leak in dwarf_unwinder_dump() where we didn't free the
memory that we had previously allocated for the DWARF frames and DWARF
registers.

Now is also a opportune time to implement our own mempool and kmem
cache. It's a good idea to have a certain number of frame and register
objects in reserve at all times, so that we are guaranteed to have our
allocation satisfied even when memory is scarce. Since we have pools to
allocate from we can implement the registers for each frame as a linked
list as opposed to a sparsely populated array. Whilst it's true that the
lookup time for a linked list is larger than for arrays, there's only
usually a maximum of 8 registers per frame. So the overhead isn't that
much of a concern.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
arch/sh/include/asm/dwarf.h
arch/sh/kernel/dwarf.c