aboutsummaryrefslogtreecommitdiff
path: root/core/malloc.c
AgeCommit message (Collapse)AuthorFilesLines
2015-05-13core: Move free-list locking to a separate per-region lockJeremy Kerr1-6/+6
Currently, we have a single lock for the entire mem_region system; this protects both the global region list, and the allocations from each region. This means we can't allocate memory while traversing the global region list, as any malloc/realloc/free will try to acquire the mem_region lock again. This change separates the locking into different functions. We keep the mem_region_lock to protect the regions list, and introduce a per-region lock to protect allocations from the regions' free_lists. Then we remove the open-coded invocations of mem_alloc, where we'd avoided malloc() due to the above locking issue. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-10-17Rename mem_size() to mem_allocated_size()Stewart Smith1-1/+1
This better states the intention of what it should return. I was bit unsure when fixing mem_size(), so hopefully this makes future me (or other people) less unsure as to the intended return value of this function. No functional changes, just rename. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Acked-by: Rusty Russell <rusty@au1.ibm.com>
2014-07-02Initial commit of Open Source releaseBenjamin Herrenschmidt1-0/+84
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>