From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqNDg-0007rE-3c for qemu-devel@nongnu.org; Thu, 07 May 2015 10:56:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqNDe-0008O2-TG for qemu-devel@nongnu.org; Thu, 07 May 2015 10:56:12 -0400 Message-ID: <554B7CD9.4070105@redhat.com> Date: Thu, 07 May 2015 08:55:21 -0600 From: Eric Blake MIME-Version: 1.0 References: <97f3d8a1ff7cbb2922a1d1c2007d7ccf44859294.1430919406.git.berto@igalia.com> In-Reply-To: <97f3d8a1ff7cbb2922a1d1c2007d7ccf44859294.1430919406.git.berto@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HOCv0cDxuk06NwlsQgqNR1Ci2dRfaKgmU" Subject: Re: [Qemu-devel] [PATCH 3/7] qcow2: use an LRU algorithm to replace entries from the L2 cache List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HOCv0cDxuk06NwlsQgqNR1Ci2dRfaKgmU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/06/2015 07:39 AM, Alberto Garcia wrote: > The current algorithm to evict entries from the cache gives always > preference to those in the lowest positions. As the size of the cache > increases, the chances of the later elements of being removed decrease > exponentially. >=20 > In a scenario with random I/O and lots of cache misses, entries in > positions 8 and higher are rarely (if ever) evicted. This can be seen > even with the default cache size, but with larger caches the problem > becomes more obvious. >=20 > Using an LRU algorithm makes the chances of being removed from the > cache independent from the position. >=20 > Signed-off-by: Alberto Garcia > --- > block/qcow2-cache.c | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) >=20 > @@ -318,12 +315,10 @@ static int qcow2_cache_do_get(BlockDriverState *b= s, Qcow2Cache *c, > =20 > /* Give the table some hits for the start so that it won't be repl= aced > * immediately. The number 32 is completely arbitrary. */ > - c->entries[i].cache_hits =3D 32; > c->entries[i].offset =3D offset; The comment is now dead. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --HOCv0cDxuk06NwlsQgqNR1Ci2dRfaKgmU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVS3zaAAoJEKeha0olJ0NqRpwH/1AGKdT6XUW9Q9AvsfAZdeSY CXOb6+bPPuZFiogvmGzwyfAk9wIQE9lFSSaeZL/iaYvatovRETzFaE9TPMdtbNIB M1Ipgx62OpSTa0SyoVeCVFKbxT7iXDv2CW1ClBysKmJnzvruTZUK5pp0qsCELzVE DT4sb9wpuC8UKCNpPqRBXb34wfFGxMq+PJNWb7RNeNKsCH6N83z86+D+iUNrYReT C/dnce4+xIRkQQ05u55ljlGcsgGx+YXq2ordquswnVUmCKldxHVtHQzF7TcNJQJl kb/Lp9iMtYemDJjKCkhuUzWTBQ15k175UFsYfF1aHJS902iqUUBgRf0Uou+8Sbg= =tYw7 -----END PGP SIGNATURE----- --HOCv0cDxuk06NwlsQgqNR1Ci2dRfaKgmU--