Received: from eggs.gnu.org ([2001:4830:134:3::10]:47595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1ztA-0006YR-0f for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:27:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1zt5-0001Kb-P7 for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:27:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1zt5-0001K7-K3 for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:26:59 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 2A5D88F269 for ; Mon, 8 Jun 2015 16:26:59 +0000 (UTC) Date: Mon, 8 Jun 2015 18:26:56 +0200 From: Igor Mammedov Message-ID: <20150608182656.22580731@nial.brq.redhat.com> In-Reply-To: <5575BE2D.7060603@redhat.com> 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> <5575BE2D.7060603@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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: Paolo Bonzini Cc: qemu-devel@nongnu.org, mst@redhat.com On Mon, 08 Jun 2015 18:09:17 +0200 Paolo Bonzini wrote: > > > 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. :) ok, I'll post it as separate cleanup patch as it doesn't depend on the rest of series. > > Paolo