From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO134-0007iY-2V for qemu-devel@nongnu.org; Tue, 26 Jan 2016 05:40:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aO133-0007dj-6a for qemu-devel@nongnu.org; Tue, 26 Jan 2016 05:40:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO133-0007de-1l for qemu-devel@nongnu.org; Tue, 26 Jan 2016 05:40:33 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id AB612461D3 for ; Tue, 26 Jan 2016 10:40:32 +0000 (UTC) References: <20160122091501.75bbd42a@redhat.com> From: Paolo Bonzini Message-ID: <56A74D1A.1070909@redhat.com> Date: Tue, 26 Jan 2016 11:40:26 +0100 MIME-Version: 1.0 In-Reply-To: <20160122091501.75bbd42a@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] memory: exit when hugepage allocation fails if mem-prealloc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino , imammedo@redhat.com Cc: armbru@redhat.com, qemu-devel On 22/01/2016 15:15, Luiz Capitulino wrote: > 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 > --- > numa.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/numa.c b/numa.c > index 425ef8d..0e1638d 100644 > --- a/numa.c > +++ b/numa.c > @@ -418,12 +418,13 @@ 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 > Right, patch cc57501dee did the correct change but it was insufficient. I'll add the braces for you and queue the patch. Paolo