Received: from eggs.gnu.org ([2001:4830:134:3::10]:39006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1zbM-0002PX-SZ for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:08:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1zbH-0005ep-Qk for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:08:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1zbH-0005ea-Fc for qemu-devel@nongnu.org; Mon, 08 Jun 2015 12:08:35 -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 13FBD8EB4A for ; Mon, 8 Jun 2015 16:08:35 +0000 (UTC) Date: Mon, 8 Jun 2015 18:08:30 +0200 From: Igor Mammedov Message-ID: <20150608180830.3a889453@nial.brq.redhat.com> In-Reply-To: <5575B377.5030701@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> 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 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). > > Paolo > > > - break; > > - } > > - } > > - qemu_mutex_unlock_ramlist();