From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:32822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiZCA-0006dB-KL for qemu-devel@nongnu.org; Wed, 04 Jan 2012 17:20:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RiZC8-0003dN-TA for qemu-devel@nongnu.org; Wed, 04 Jan 2012 17:20:30 -0500 Received: from e7.ny.us.ibm.com ([32.97.182.137]:43297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiZC8-0003dH-PL for qemu-devel@nongnu.org; Wed, 04 Jan 2012 17:20:28 -0500 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Jan 2012 17:20:27 -0500 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q04MKOB9330612 for ; Wed, 4 Jan 2012 17:20:24 -0500 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q04MKLbO016439 for ; Wed, 4 Jan 2012 15:20:23 -0700 Message-ID: <4F04D0A2.70701@linux.vnet.ibm.com> Date: Wed, 04 Jan 2012 16:20:18 -0600 From: Michael Roth MIME-Version: 1.0 References: <1325604879-15862-1-git-send-email-owasserm@redhat.com> <1325604879-15862-2-git-send-email-owasserm@redhat.com> <4F035D05.1020800@codemonkey.ws> <4F041BE8.80407@redhat.com> In-Reply-To: <4F041BE8.80407@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 1/9] Add cache handling functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Orit Wasserman Cc: blauwirbel@gmail.com, stefanha@gmail.com, qemu-devel@nongnu.org, quintela@redhat.com On 01/04/2012 03:29 AM, Orit Wasserman wrote: > On 01/03/2012 09:54 PM, Anthony Liguori wrote: >> On 01/03/2012 09:34 AM, Orit Wasserman wrote: >>> Add page caching mechanism. >>> The pages are stored in the cache ordered by their address. >>> >>> Signed-off-by: Orit Wasserman >>> --- >>> arch_init.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >>> 1 files changed, 183 insertions(+), 0 deletions(-) >>> >>> diff --git a/arch_init.c b/arch_init.c >>> index d4c92b0..fdda277 100644 >>> --- a/arch_init.c >>> +++ b/arch_init.c >>> @@ -28,6 +28,7 @@ >>> #include >>> #include >>> #endif >>> +#include >>> #include "config.h" >>> #include "monitor.h" >>> #include "sysemu.h" >>> @@ -42,6 +43,14 @@ >>> #include "gdbstub.h" >>> #include "hw/smbios.h" >>> >>> +#ifdef DEBUG_ARCH_INIT >>> +#define DPRINTF(fmt, ...) \ >>> + do { fprintf(stdout, "arch_init: " fmt, ## __VA_ARGS__); } while (0) >>> +#else >>> +#define DPRINTF(fmt, ...) \ >>> + do { } while (0) >>> +#endif >>> + >>> #ifdef TARGET_SPARC >>> int graphic_width = 1024; >>> int graphic_height = 768; >>> @@ -94,6 +103,180 @@ const uint32_t arch_type = QEMU_ARCH; >>> #define RAM_SAVE_FLAG_EOS 0x10 >>> #define RAM_SAVE_FLAG_CONTINUE 0x20 >>> >>> +/***********************************************************/ >>> +/* Page cache for storing previous pages as basis for XBRLE compression */ >>> +#define CACHE_N_WAY 2 /* 2-way assossiative cache */ >> >> Is there any reason we can't just use a GCache for this? >> >> http://developer.gnome.org/glib/stable/glib-Caches.html > I'm not familiar with I will check. > Is it 2-way associative cache ? Not quite...it's a very loose wrapper around GHashTable, which appears to be fully associative in nature. It also doesn't seem to allow you to do a lookup without destroying the table entry =\ (unless you do something hacky like an extra insert beforehand to jack up the refcount). If you go this route you're probably better off looking at GHashTable directly. > > Orit >> >> Regards, >> >> Anthony Liguori > >