cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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