From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1zc6-0003aK-D3 for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:09:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1zc1-0005yw-J8 for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:09:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1zc1-0005ym-Es for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:09:21 -0400 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 3442FBACDB for ; Mon, 8 Jun 2015 16:09:21 +0000 (UTC) Message-ID: <5575BE2D.7060603@redhat.com> Date: Mon, 08 Jun 2015 18:09:17 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1433776757-61958-1-git-send-email-imammedo@redhat.com> <1433776757-61958-2-git-send-email-imammedo@redhat.com> <5575B377.5030701@redhat.com> <20150608180830.3a889453@nial.brq.redhat.com> In-Reply-To: <20150608180830.3a889453@nial.brq.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v2 1/6] memory: get rid of memory_region_destructor_ram_from_ptr() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, mst@redhat.com On 08/06/2015 18:08, Igor Mammedov wrote: > On Mon, 08 Jun 2015 17:23:35 +0200 > Paolo Bonzini wrote: > >> >> >> On 08/06/2015 17:19, Igor Mammedov wrote: >>> - qemu_mutex_lock_ramlist(); >>> - QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { >>> - if (addr == block->offset) { >>> - QLIST_REMOVE_RCU(block, next); >>> - ram_list.mru_block = NULL; >>> - /* Write list before version */ >>> - smp_wmb(); >>> - ram_list.version++; >>> - g_free_rcu(block, rcu); >> >> qemu_ram_free here does: >> >> call_rcu(block, reclaim_ramblock, rcu); >> >> which is different. > > > qemu_ram_free() calls reclaim_ramblock() which does: > > if (!(block->flags & RAM_PREALLOC)) > free_host_memory() > > g_free(block) > > while > g_free_rcu(block, rcu) results -> g_free(block) > > and for memory_region_init_ram_ptr() we set RAM_PREALLOC > so qemu_ram_free() degrades to g_free(block). Please put this in the commit message. :) Paolo