|
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>
|