xmalloc: make close-to-PAGE_SIZE allocations more efficient
authorJan Beulich <jbeulich@suse.com>
Tue, 19 Feb 2013 09:49:53 +0000 (10:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 19 Feb 2013 09:49:53 +0000 (10:49 +0100)
commitfb034f42648ecac835a1666def468f673edd2725
treeb8cd2374d3fe0e45a86580bed0545b71aac05eb5
parentd551606308f3cbcce58a32a0850d1c4a8f6d2088
xmalloc: make close-to-PAGE_SIZE allocations more efficient

Rather than bumping their sizes to slightly above (a multiple of)
PAGE_SIZE (in order to store tracking information), thus requiring
a non-order-0 allocation even when no more than a page is being
requested, return the result of alloc_xenheap_pages() directly, and use
the struct page_info field underlying PFN_ORDER() to store the actual
size (needed for freeing the memory).

This leverages the fact that sub-allocation of memory obtained from the
page allocator can only ever result in non-page-aligned memory chunks
(with the exception of zero size allocations with sufficiently high
alignment being requested, which is why zero-size allocations now get
special cased).

Use the new property to simplify allocation of the trap info array for
PV guests on x86.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/domain.c
xen/common/xmalloc_tlsf.c
xen/include/asm-x86/config.h