From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjlPY-0000VA-Bx for qemu-devel@nongnu.org; Mon, 12 May 2014 04:16:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjlPP-0002c2-4s for qemu-devel@nongnu.org; Mon, 12 May 2014 04:16:36 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:60556 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjlPO-0002by-Qy for qemu-devel@nongnu.org; Mon, 12 May 2014 04:16:27 -0400 Message-ID: <53708355.2080604@kamp.de> Date: Mon, 12 May 2014 10:16:21 +0200 From: Peter Lieven MIME-Version: 1.0 References: <1399719075-11517-1-git-send-email-pl@kamp.de> <536E46C3.1050502@redhat.com> <536E5495.6080401@kamp.de> <53706580.2050306@redhat.com> In-Reply-To: <53706580.2050306@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: dgilbert@redhat.com, quintela@redhat.com Am 12.05.2014 08:09, schrieb Paolo Bonzini: > Il 10/05/2014 18:32, Peter Lieven ha scritto: >> What about XEN? >> > > You're right, Xen wouldn't work. Your original patch would not break it just because Xen doesn't use migration (but the code would be broken). > > You would have to cache qemu_get_ram_block rather than qemu_get_ram_ptr, move RAMBlock to memory-internal.h, and split the RAMBlock + ram_addr_t => void * conversion out of qemu_get_ram_ptr and into a separate function (to be used by memory_region_get_ram_ptr). > > I'm not sure of the benefit of your patch though. qemu_get_ram_block already has a 1-item cache, are you seeing a low hit rate there? Or any other profiling that shows qemu_get_ram_ptr as hot? qemu_get_ram_ptr is hot only during migration. But the hit-rate of the LRU cache seems to be good. I am wondering if this is different if the migration has difficulties to converge, but you might be right it should be neglectible. I ran some basic migration tests with and without the patch. It might be that the results with the cache are slightly better, but the variance of the results is high. I had to run a significant number of tests to get more evidence. Peter > > Paolo