From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvj2a-0000L4-NC for qemu-devel@nongnu.org; Mon, 09 Nov 2015 04:47:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zvj2X-0000lb-Gq for qemu-devel@nongnu.org; Mon, 09 Nov 2015 04:47:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvj2X-0000lR-BF for qemu-devel@nongnu.org; Mon, 09 Nov 2015 04:47:05 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 6FCE18F50C for ; Mon, 9 Nov 2015 09:47:04 +0000 (UTC) References: <1446847881-9385-1-git-send-email-ehabkost@redhat.com> From: Paolo Bonzini Message-ID: <56406B91.4060602@redhat.com> Date: Mon, 9 Nov 2015 10:46:57 +0100 MIME-Version: 1.0 In-Reply-To: <1446847881-9385-1-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] exec: Remove unnecessary RAM_FILE flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" On 06/11/2015 23:11, Eduardo Habkost wrote: > The only code that sets RAMBlock.fd is file_ram_alloc(), and the only > code that calls file_ram_alloc() sets the RAM_FILE flag. That means the > flag is always set when RAMBlock.fd >= 0, and the munmap() call at > reclaim_ramblock() is dead code that never runs. > > Signed-off-by: Eduardo Habkost > --- > exec.c | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/exec.c b/exec.c > index a028961..9eb8b4b 100644 > --- a/exec.c > +++ b/exec.c > @@ -88,9 +88,6 @@ static MemoryRegion io_mem_unassigned; > */ > #define RAM_RESIZEABLE (1 << 2) > > -/* RAM is backed by an mmapped file. > - */ > -#define RAM_FILE (1 << 3) > #endif > > struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); > @@ -1597,7 +1594,6 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, > new_block->used_length = size; > new_block->max_length = size; > new_block->flags = share ? RAM_SHARED : 0; > - new_block->flags |= RAM_FILE; > new_block->host = file_ram_alloc(new_block, size, > mem_path, errp); > if (!new_block->host) { > @@ -1699,11 +1695,7 @@ static void reclaim_ramblock(RAMBlock *block) > xen_invalidate_map_cache_entry(block->host); > #ifndef _WIN32 > } else if (block->fd >= 0) { > - if (block->flags & RAM_FILE) { > - qemu_ram_munmap(block->host, block->max_length); > - } else { > - munmap(block->host, block->max_length); > - } > + qemu_ram_munmap(block->host, block->max_length); > close(block->fd); > #endif > } else { > Queued for 2.6, thanks. Paolo