[kvm-unit-tests GIT PULL 02/13] lib: s390x: sie: Allocate physical guest memory via memalign
Janosch Frank <[email protected]>
| Newsgroups | org.kernel.vger.kvm,org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
alloc_pages_flags() alignes the allocation on the same order as its requested size. Since we use virtual memory for SIE we can instead align to 1MB by using memalign() which is less wasteful. Signed-off-by: Janosch Frank <[email protected]> Reviewed-by: Christoph Schlameuss <[email protected]> Reviewed-by: Nico Boehr <[email protected]> --- lib/s390x/sie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c index 47d4cdde..8757f610 100644 --- a/lib/s390x/sie.c +++ b/lib/s390x/sie.c @@ -171,7 +171,8 @@ uint8_t *sie_guest_alloc(uint64_t guest_size) guest_virt = (uint8_t *)ALIGN(get_ram_size() + guest_counter * 4UL * SZ_1G, SZ_2G); guest_counter++; - guest_phys = alloc_pages(get_order(guest_size) - 12); + guest_phys = memalign_pages(SZ_1M, guest_size); + assert(guest_phys); /* * Establish a new mapping of the guest memory so it can be 2GB aligned * without actually requiring 2GB physical memory. -- 2.53.0