26ba25
From e3455ccc52d50010fdbd1940d7efebd28c65f3ad Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Thu, 6 Dec 2018 17:12:27 +0000
26ba25
Subject: [PATCH 02/15] docs: Document the new default sizes of the qcow2
26ba25
 caches
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20181206171240.5674-3-kwolf@redhat.com>
26ba25
Patchwork-id: 83297
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 02/15] docs: Document the new default sizes of the qcow2 caches
26ba25
Bugzilla: 1656507
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: John Snow <jsnow@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
26ba25
From: Alberto Garcia <berto@igalia.com>
26ba25
26ba25
We have just reduced the refcount cache size to the minimum unless
26ba25
the user explicitly requests a larger one, so we have to update the
26ba25
documentation to reflect this change.
26ba25
26ba25
Signed-off-by: Alberto Garcia <berto@igalia.com>
26ba25
Message-id: c5f0bde23558dd9d33b21fffc76ac9953cc19c56.1523968389.git.berto@igalia.com
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
Signed-off-by: Max Reitz <mreitz@redhat.com>
26ba25
(cherry picked from commit 603790ef3aec6a19b1c095188a1d2171934a27de)
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 docs/qcow2-cache.txt | 33 ++++++++++++++++-----------------
26ba25
 1 file changed, 16 insertions(+), 17 deletions(-)
26ba25
26ba25
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
26ba25
index 170191a..8a09a5c 100644
26ba25
--- a/docs/qcow2-cache.txt
26ba25
+++ b/docs/qcow2-cache.txt
26ba25
@@ -116,31 +116,30 @@ There are three options available, and all of them take bytes:
26ba25
 "refcount-cache-size":   maximum size of the refcount block cache
26ba25
 "cache-size":            maximum size of both caches combined
26ba25
 
26ba25
-There are two things that need to be taken into account:
26ba25
+There are a few things that need to be taken into account:
26ba25
 
26ba25
  - Both caches must have a size that is a multiple of the cluster size
26ba25
    (or the cache entry size: see "Using smaller cache sizes" below).
26ba25
 
26ba25
- - If you only set one of the options above, QEMU will automatically
26ba25
-   adjust the others so that the L2 cache is 4 times bigger than the
26ba25
-   refcount cache.
26ba25
+ - The default L2 cache size is 8 clusters or 1MB (whichever is more),
26ba25
+   and the minimum is 2 clusters (or 2 cache entries, see below).
26ba25
 
26ba25
-This means that these options are equivalent:
26ba25
+ - The default (and minimum) refcount cache size is 4 clusters.
26ba25
 
26ba25
-   -drive file=hd.qcow2,l2-cache-size=2097152
26ba25
-   -drive file=hd.qcow2,refcount-cache-size=524288
26ba25
-   -drive file=hd.qcow2,cache-size=2621440
26ba25
+ - If only "cache-size" is specified then QEMU will assign as much
26ba25
+   memory as possible to the L2 cache before increasing the refcount
26ba25
+   cache size.
26ba25
 
26ba25
-The reason for this 1/4 ratio is to ensure that both caches cover the
26ba25
-same amount of disk space. Note however that this is only valid with
26ba25
-the default value of refcount_bits (16). If you are using a different
26ba25
-value you might want to calculate both cache sizes yourself since QEMU
26ba25
-will always use the same 1/4 ratio.
26ba25
+Unlike L2 tables, refcount blocks are not used during normal I/O but
26ba25
+only during allocations and internal snapshots. In most cases they are
26ba25
+accessed sequentially (even during random guest I/O) so increasing the
26ba25
+refcount cache size won't have any measurable effect in performance
26ba25
+(this can change if you are using internal snapshots, so you may want
26ba25
+to think about increasing the cache size if you use them heavily).
26ba25
 
26ba25
-It's also worth mentioning that there's no strict need for both caches
26ba25
-to cover the same amount of disk space. The refcount cache is used
26ba25
-much less often than the L2 cache, so it's perfectly reasonable to
26ba25
-keep it small.
26ba25
+Before QEMU 2.12 the refcount cache had a default size of 1/4 of the
26ba25
+L2 cache size. This resulted in unnecessarily large caches, so now the
26ba25
+refcount cache is as small as possible unless overridden by the user.
26ba25
 
26ba25
 
26ba25
 Using smaller cache entries
26ba25
-- 
26ba25
1.8.3.1
26ba25