diff mbox series

[v6,5/8] qcow2: Increase the default upper limit on the L2 cache size

Message ID 20180809215307.18241-6-lbloch@janustech.com (mailing list archive)
State New, archived
Headers show
Series qcow2: Take the image size into account when allocating the L2 cache | expand

Commit Message

Leonid Bloch Aug. 9, 2018, 9:53 p.m. UTC
The upper limit on the L2 cache size is increased from 1 MB to 32 MB.
This is done in order to allow default full coverage of an image with
the L2 cache for images of up to 256 GB in size (was 8 GB). Note, that
only the needed amount to cover the full image is allocated. The value
which is changed here is just the upper limit on the L2 cache size,
beyond which it will not grow, even if the size of the image requires
it to.

Signed-off-by: Leonid Bloch <lbloch@janustech.com>
---
 block/qcow2.h        | 2 +-
 docs/qcow2-cache.txt | 6 +++---
 qemu-options.hx      | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Eric Blake Aug. 9, 2018, 10:03 p.m. UTC | #1
On 08/09/2018 04:53 PM, Leonid Bloch wrote:
> The upper limit on the L2 cache size is increased from 1 MB to 32 MB.
> This is done in order to allow default full coverage of an image with
> the L2 cache for images of up to 256 GB in size (was 8 GB). Note, that
> only the needed amount to cover the full image is allocated. The value
> which is changed here is just the upper limit on the L2 cache size,
> beyond which it will not grow, even if the size of the image requires
> it to.
> 
> Signed-off-by: Leonid Bloch <lbloch@janustech.com>
> ---
>   block/qcow2.h        | 2 +-
>   docs/qcow2-cache.txt | 6 +++---
>   qemu-options.hx      | 2 +-
>   3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/block/qcow2.h b/block/qcow2.h
> index 0bab3d8b94..d77a31d932 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h
> @@ -73,7 +73,7 @@
>   /* Must be at least 4 to cover all cases of refcount table growth */
>   #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */
>   
> -#define DEFAULT_L2_CACHE_MAX_SIZE 1048576  /* bytes */
> +#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U /* bytes */

I'd spell this as '(64 * MiB)' with the help of "qemu/units.h".
Leonid Bloch Aug. 10, 2018, 5:33 a.m. UTC | #2
>> --- a/block/qcow2.h
>> +++ b/block/qcow2.h
>> @@ -73,7 +73,7 @@
>>   /* Must be at least 4 to cover all cases of refcount table growth */
>>   #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */
>> -#define DEFAULT_L2_CACHE_MAX_SIZE 1048576  /* bytes */
>> +#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U /* bytes */
> 
> I'd spell this as '(64 * MiB)' with the help of "qemu/units.h".
> 

You mean '(32 * MiB)', right? Good idea! Done.

Leonid.
diff mbox series

Patch

diff --git a/block/qcow2.h b/block/qcow2.h
index 0bab3d8b94..d77a31d932 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -73,7 +73,7 @@ 
 /* Must be at least 4 to cover all cases of refcount table growth */
 #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */
 
-#define DEFAULT_L2_CACHE_MAX_SIZE 1048576  /* bytes */
+#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U /* bytes */
 
 #define DEFAULT_CLUSTER_SIZE 65536
 
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
index 69af306267..6ad1081d1a 100644
--- a/docs/qcow2-cache.txt
+++ b/docs/qcow2-cache.txt
@@ -125,8 +125,8 @@  There are a few things that need to be taken into account:
    (or the cache entry size: see "Using smaller cache sizes" below).
 
  - The default L2 cache size will cover the entire virtual size of an
-   image, up to a certain maximum. This maximum is 1 MB by default
-   (enough for image sizes of up to 8 GB with the default cluster size)
+   image, up to a certain maximum. This maximum is 32 MB by default
+   (enough for image sizes of up to 256 GB with the default cluster size)
    and it can be reduced or enlarged using the "l2-cache-size" option.
    The minimum is 2 clusters (or 2 cache entries, see below).
 
@@ -186,7 +186,7 @@  Some things to take into account:
    always uses the cluster size as the entry size.
 
  - If the L2 cache is big enough to hold all of the image's L2 tables
-   (the default behavior for images of up to 8 GB in size) then none
+   (the default behavior for images of up to 256 GB in size) then none
    of this is necessary and you can omit the "l2-cache-entry-size"
    parameter altogether.
 
diff --git a/qemu-options.hx b/qemu-options.hx
index 22e8e2d113..4c44cdbc23 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -756,7 +756,7 @@  The maximum total size of the L2 table and refcount block caches in bytes
 
 @item l2-cache-size
 The maximum size of the L2 table cache in bytes
-(default: if cache-size is not specified - 1M; otherwise, as large as possible
+(default: if cache-size is not specified - 32M; otherwise, as large as possible
 within the cache-size, while permitting the requested or the minimal refcount
 cache size)