From d0e4e94f78ce80662b5df62412ca94361a6fd5cc Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Tue, 26 Jan 2016 22:03:10 +0100 Subject: [PATCH] memory: exit when hugepage allocation fails if mem-prealloc RH-Author: Luiz Capitulino Message-id: <20160126170310.6c751258@redhat.com> Patchwork-id: 69056 O-Subject: [RHEL7.2.z qemu-kvm-rhev PATCH] memory: exit when hugepage allocation fails if mem-prealloc Bugzilla: 1324523 RH-Acked-by: Marcelo Tosatti RH-Acked-by: Igor Mammedov RH-Acked-by: Paolo Bonzini When -mem-prealloc is passed on the command-line, the expected behavior is to exit if the hugepage allocation fails. However, this behavior is broken since commit cc57501dee which made hugepage allocation fall back to regular ram in case of faliure. This commit restores the expected behavior for -mem-prealloc. Signed-off-by: Luiz Capitulino Message-Id: <20160122091501.75bbd42a@redhat.com> Signed-off-by: Paolo Bonzini (cherry picked from commit fae947b096020e5004ec7ae106a95a69a5e4d929) Signed-off-by: Luiz Capitulino Signed-off-by: Miroslav Rezanina --- numa.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/numa.c b/numa.c index 6ea2237..c1ac057 100644 --- a/numa.c +++ b/numa.c @@ -419,12 +419,15 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner, Error *err = NULL; memory_region_init_ram_from_file(mr, owner, name, ram_size, false, mem_path, &err); - - /* Legacy behavior: if allocation failed, fall back to - * regular RAM allocation. - */ if (err) { error_report_err(err); + if (mem_prealloc) { + exit(1); + } + + /* Legacy behavior: if allocation failed, fall back to + * regular RAM allocation. + */ memory_region_init_ram(mr, owner, name, ram_size, &error_fatal); } #else -- 1.8.3.1