From patchwork Fri Jan 22 14:15:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 8090761 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6B8FB9F859 for ; Fri, 22 Jan 2016 14:36:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC03E203F7 for ; Fri, 22 Jan 2016 14:36:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21AF120256 for ; Fri, 22 Jan 2016 14:36:26 +0000 (UTC) Received: from localhost ([::1]:54161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMcp7-0000Um-IR for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 Jan 2016 09:36:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMcoy-0000UU-0v for qemu-devel@nongnu.org; Fri, 22 Jan 2016 09:36:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMcov-0005cy-2y for qemu-devel@nongnu.org; Fri, 22 Jan 2016 09:36:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMcou-0005cj-Td for qemu-devel@nongnu.org; Fri, 22 Jan 2016 09:36:13 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 1A49DBAEDC for ; Fri, 22 Jan 2016 14:36:12 +0000 (UTC) Received: from localhost (ovpn-113-102.phx2.redhat.com [10.3.113.102]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MEaBMa004438; Fri, 22 Jan 2016 09:36:11 -0500 Date: Fri, 22 Jan 2016 09:15:01 -0500 From: Luiz Capitulino To: imammedo@redhat.com Message-ID: <20160122091501.75bbd42a@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, armbru@redhat.com, qemu-devel Subject: [Qemu-devel] [PATCH] memory: exit when hugepage allocation fails if mem-prealloc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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