]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Core/Dxe/Mem/Pool.c
MdeModulePkg: serve allocations from higher-up bins if current bin is empty
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 6 Mar 2015 02:57:11 +0000 (02:57 +0000)
committerlgao4 <lgao4@Edk2>
Fri, 6 Mar 2015 02:57:11 +0000 (02:57 +0000)
commit6860b92c847caff16b8cbc58ca31e3dbf9c5e5cc
tree0c0acf0e63e82d5ef78728fe433513f912c7b58f
parentf8aabf6e4c199e92498512e1d0cf9a347b62e491
MdeModulePkg: serve allocations from higher-up bins if current bin is empty

This patch changes the allocation logic for the pool allocator to only
allocate additional pages if the requested allocation cannot be fulfilled
from the current bin or any of the larger ones. If there are larger blocks
available, they will be used to serve the allocation, and the remainder will
be carved up into smaller blocks using the existing carving up logic.
Note that all pool sizes are a multiple of the smallest pool size, so it is
guaranteed that the remainder will be carved up without spilling. Due to the
exponential nature of the pool sizes, the amount of work is logarithmic in
the size of the available block.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17015 6f19259b-4bc3-4df7-8a09-765794883524
MdeModulePkg/Core/Dxe/Mem/Pool.c