From patchwork Mon Jun 25 16:55:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 167169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 652DC1007D2 for ; Tue, 26 Jun 2012 02:55:36 +1000 (EST) Received: from localhost ([::1]:51523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjCZa-0005Cy-Al for incoming@patchwork.ozlabs.org; Mon, 25 Jun 2012 12:55:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjCZK-00054h-Po for qemu-devel@nongnu.org; Mon, 25 Jun 2012 12:55:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjCZF-0003ZY-25 for qemu-devel@nongnu.org; Mon, 25 Jun 2012 12:55:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjCZE-0003YM-QO for qemu-devel@nongnu.org; Mon, 25 Jun 2012 12:55:12 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5PGtB3N028439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Jun 2012 12:55:11 -0400 Received: from localhost (ovpn-113-122.phx2.redhat.com [10.3.113.122]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5PGtAXL023670; Mon, 25 Jun 2012 12:55:10 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 25 Jun 2012 13:55:31 -0300 Message-Id: <1340643332-5653-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1340643332-5653-1-git-send-email-lcapitulino@redhat.com> References: <1340643332-5653-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aarcange@redhat.com, avi@redhat.com Subject: [Qemu-devel] [RFC 2/3] memory: add RAM_MERGEABLE flag to RAMBlock 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Will be used by the next commit. Signed-off-by: Luiz Capitulino --- cpu-all.h | 1 + exec.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/cpu-all.h b/cpu-all.h index 429c1c3..9a36f7e 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -469,6 +469,7 @@ extern ram_addr_t ram_size; /* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */ #define RAM_PREALLOC_MASK (1 << 0) +#define RAM_MERGEABLE (1 << 1) typedef struct RAMBlock { struct MemoryRegion *mr; diff --git a/exec.c b/exec.c index c003789..e29b27f 100644 --- a/exec.c +++ b/exec.c @@ -2535,6 +2535,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, new_block->host = file_ram_alloc(new_block, size, mem_path); if (!new_block->host) { new_block->host = qemu_vmalloc(size); + new_block->flags |= RAM_MERGEABLE; madvise_mergeable(new_block->host, size); } #else @@ -2562,6 +2563,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, new_block->host = qemu_vmalloc(size); } #endif + new_block->flags |= RAM_MERGEABLE; madvise_mergeable(new_block->host, size); } } @@ -2689,6 +2691,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) length, addr); exit(1); } + block->flags |= RAM_MERGEABLE; madvise_mergeable(vaddr, length); } return;