Blame SOURCES/kvm-qcow2-Increase-the-default-upper-limit-on-the-L2-cac.patch

ae23c9
From 64f611dddac96852363e4638954e0722a28420e6 Mon Sep 17 00:00:00 2001
ae23c9
From: Kevin Wolf <kwolf@redhat.com>
ae23c9
Date: Thu, 6 Dec 2018 17:12:35 +0000
ae23c9
Subject: [PATCH 10/15] qcow2: Increase the default upper limit on the L2 cache
ae23c9
 size
ae23c9
ae23c9
RH-Author: Kevin Wolf <kwolf@redhat.com>
ae23c9
Message-id: <20181206171240.5674-11-kwolf@redhat.com>
ae23c9
Patchwork-id: 83290
ae23c9
O-Subject: [RHEL-8.0 qemu-kvm PATCH 10/15] qcow2: Increase the default upper limit on the L2 cache size
ae23c9
Bugzilla: 1656507
ae23c9
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ae23c9
RH-Acked-by: John Snow <jsnow@redhat.com>
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
ae23c9
From: Leonid Bloch <lbloch@janustech.com>
ae23c9
ae23c9
The upper limit on the L2 cache size is increased from 1 MB to 32 MB
ae23c9
on Linux platforms, and to 8 MB on other platforms (this difference is
ae23c9
caused by the ability to set intervals for cache cleaning on Linux
ae23c9
platforms only).
ae23c9
ae23c9
This is done in order to allow default full coverage with the L2 cache
ae23c9
for images of up to 256 GB in size (was 8 GB). Note, that only the
ae23c9
needed amount to cover the full image is allocated. The value which is
ae23c9
changed here is just the upper limit on the L2 cache size, beyond which
ae23c9
it will not grow, even if the size of the image will require it to.
ae23c9
ae23c9
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
ae23c9
Reviewed-by: Alberto Garcia <berto@igalia.com>
ae23c9
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
(cherry picked from commit 80668d0fb735f0839a46278a7d42116089b82816)
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 block/qcow2.h        |  6 +++++-
ae23c9
 docs/qcow2-cache.txt | 15 +++++++++------
ae23c9
 qemu-options.hx      |  6 +++---
ae23c9
 3 files changed, 17 insertions(+), 10 deletions(-)
ae23c9
ae23c9
diff --git a/block/qcow2.h b/block/qcow2.h
ae23c9
index d0dd4a2..6c6c742 100644
ae23c9
--- a/block/qcow2.h
ae23c9
+++ b/block/qcow2.h
ae23c9
@@ -74,7 +74,11 @@
ae23c9
 /* Must be at least 4 to cover all cases of refcount table growth */
ae23c9
 #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */
ae23c9
 
ae23c9
-#define DEFAULT_L2_CACHE_MAX_SIZE S_1MiB
ae23c9
+#ifdef CONFIG_LINUX
ae23c9
+#define DEFAULT_L2_CACHE_MAX_SIZE S_32MiB
ae23c9
+#else
ae23c9
+#define DEFAULT_L2_CACHE_MAX_SIZE S_8MiB
ae23c9
+#endif
ae23c9
 
ae23c9
 #define DEFAULT_CLUSTER_SIZE S_64KiB
ae23c9
 
ae23c9
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
ae23c9
index 750447e..1fcc065 100644
ae23c9
--- a/docs/qcow2-cache.txt
ae23c9
+++ b/docs/qcow2-cache.txt
ae23c9
@@ -125,12 +125,15 @@ There are a few things that need to be taken into account:
ae23c9
  - Both caches must have a size that is a multiple of the cluster size
ae23c9
    (or the cache entry size: see "Using smaller cache sizes" below).
ae23c9
 
ae23c9
- - The maximum L2 cache size is 1 MB by default (enough for full coverage
ae23c9
-   of 8 GB images, with the default cluster size). This value can be
ae23c9
-   modified using the "l2-cache-size" option. QEMU will not use more memory
ae23c9
-   than needed to hold all of the image's L2 tables, regardless of this max.
ae23c9
-   value. The minimal L2 cache size is 2 clusters (or 2 cache entries, see
ae23c9
-   below).
ae23c9
+ - The maximum L2 cache size is 32 MB by default on Linux platforms (enough
ae23c9
+   for full coverage of 256 GB images, with the default cluster size). This
ae23c9
+   value can be modified using the "l2-cache-size" option. QEMU will not use
ae23c9
+   more memory than needed to hold all of the image's L2 tables, regardless
ae23c9
+   of this max. value.
ae23c9
+   On non-Linux platforms the maximal value is smaller by default (8 MB) and
ae23c9
+   this difference stems from the fact that on Linux the cache can be cleared
ae23c9
+   periodically if needed, using the "cache-clean-interval" option (see below).
ae23c9
+   The minimal L2 cache size is 2 clusters (or 2 cache entries, see below).
ae23c9
 
ae23c9
  - The default (and minimum) refcount cache size is 4 clusters.
ae23c9
 
ae23c9
diff --git a/qemu-options.hx b/qemu-options.hx
ae23c9
index 5e3bd74..e3f4e43 100644
ae23c9
--- a/qemu-options.hx
ae23c9
+++ b/qemu-options.hx
ae23c9
@@ -756,9 +756,9 @@ The maximum total size of the L2 table and refcount block caches in bytes
ae23c9
 
ae23c9
 @item l2-cache-size
ae23c9
 The maximum size of the L2 table cache in bytes
ae23c9
-(default: if cache-size is not specified - 1M; otherwise, as large as possible
ae23c9
-within the cache-size, while permitting the requested or the minimal refcount
ae23c9
-cache size)
ae23c9
+(default: if cache-size is not specified - 32M on Linux platforms, and 8M on
ae23c9
+non-Linux platforms; otherwise, as large as possible within the cache-size,
ae23c9
+while permitting the requested or the minimal refcount cache size)
ae23c9
 
ae23c9
 @item refcount-cache-size
ae23c9
 The maximum size of the refcount block cache in bytes
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9