From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Mon, 10 Oct 2016 13:39:54 +0200 Subject: [U-Boot] [PATCH v4 4/7] efi_loader: Track size of pool allocations to allow freeing In-Reply-To: References: <20161001213229.19522-5-stefan.bruens@rwth-aachen.de> Message-ID: <57FB7E0A.6040604@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/09/2016 10:17 PM, Stefan Br?ns wrote: > We need a functional free_pool implementation, as otherwise each > allocate_pool causes growth of the memory descriptor table. > > Different to free_pages, free_pool does not provide the size for the > to be freed allocation, thus we have to track the size ourselves. > > As the only EFI requirement for pool allocation is an alignment of > 8 bytes, we can keep allocating a range using the page allocator, > reserve the first 8 bytes for our bookkeeping and hand out the > remainder to the caller. This saves us from having to use any > independent data structures for tracking. > > To simplify the conversion between pool allocations and the corresponding > page allocation, we create an auxiliary struct efi_pool_allocation. > > Given the allocation size free_pool size can handoff freeing the page > range, which was indirectly allocated by a call to allocate_pool, > to free_pages. > > Signed-off-by: Stefan Br?ns Reviewed-by: Alexander Graf Alex