[Qemu-devel] [PATCH v3 0/2] Give the refcount cache the minimum possible size by default

Alberto Garcia posted 2 patches 6 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1523968389.git.berto@igalia.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test s390x passed
block/qcow2.c              | 31 +++++++++++++++++++------------
block/qcow2.h              |  4 ----
docs/qcow2-cache.txt       | 33 ++++++++++++++++-----------------
tests/qemu-iotests/137.out |  2 +-
4 files changed, 36 insertions(+), 34 deletions(-)
[Qemu-devel] [PATCH v3 0/2] Give the refcount cache the minimum possible size by default
Posted by Alberto Garcia 6 years ago
Hi,

we talked about this the other day, so here are the patches to change
the default cache sizes in qcow2.

Without this patch:

 * refcount-cache-size = l2-cache-size / 4

unless otherwise specified by the user. This is wasteful, the refcount
cache is accessed sequentially during normal I/O, so there's no point
in caching more tables. I measured the effect on the refcount cache
size when populating an empty qcow2 image using random writes, and
there's no difference between having the minimum or the maximum
sizes(*).

With this patch:

 * refcount-cache-size is always 4 clusters by default (the minimum)

 * If "cache-size" is set then l2-cache-size is set to the maximum if
   possible (disk_size * 8 / cluster_size) and the remainder is
   assigned to the refcount cache.

Regards,

Berto

(*) there is, actually: having a very large cache can even make the
    I/O slightly slower, because the larger the cache the longer it
    takes longer to find a cached entry. I only noticed this under
    tmpfs anyway.

Changes:
v3:
- Mention that if you use internal snapshots you may want to increase
  the cache size [Max]

v2: https://lists.gnu.org/archive/html/qemu-block/2018-03/msg00822.html
- s/overriden/overridden/ (in both patches)

v1: https://lists.gnu.org/archive/html/qemu-block/2018-03/msg00709.html
- Initial release

Alberto Garcia (2):
  qcow2: Give the refcount cache the minimum possible size by default
  docs: Document the new default sizes of the qcow2 caches

 block/qcow2.c              | 31 +++++++++++++++++++------------
 block/qcow2.h              |  4 ----
 docs/qcow2-cache.txt       | 33 ++++++++++++++++-----------------
 tests/qemu-iotests/137.out |  2 +-
 4 files changed, 36 insertions(+), 34 deletions(-)

-- 
2.11.0


Re: [Qemu-devel] [PATCH v3 0/2] Give the refcount cache the minimum possible size by default
Posted by Max Reitz 6 years ago
On 2018-04-17 14:37, Alberto Garcia wrote:
> Hi,
> 
> we talked about this the other day, so here are the patches to change
> the default cache sizes in qcow2.
> 
> Without this patch:
> 
>  * refcount-cache-size = l2-cache-size / 4
> 
> unless otherwise specified by the user. This is wasteful, the refcount
> cache is accessed sequentially during normal I/O, so there's no point
> in caching more tables. I measured the effect on the refcount cache
> size when populating an empty qcow2 image using random writes, and
> there's no difference between having the minimum or the maximum
> sizes(*).
> 
> With this patch:
> 
>  * refcount-cache-size is always 4 clusters by default (the minimum)
> 
>  * If "cache-size" is set then l2-cache-size is set to the maximum if
>    possible (disk_size * 8 / cluster_size) and the remainder is
>    assigned to the refcount cache.
> 
> Regards,
> 
> Berto
> 
> (*) there is, actually: having a very large cache can even make the
>     I/O slightly slower, because the larger the cache the longer it
>     takes longer to find a cached entry. I only noticed this under
>     tmpfs anyway.
> 
> Changes:
> v3:
> - Mention that if you use internal snapshots you may want to increase
>   the cache size [Max]
> 
> v2: https://lists.gnu.org/archive/html/qemu-block/2018-03/msg00822.html
> - s/overriden/overridden/ (in both patches)
> 
> v1: https://lists.gnu.org/archive/html/qemu-block/2018-03/msg00709.html
> - Initial release
> 
> Alberto Garcia (2):
>   qcow2: Give the refcount cache the minimum possible size by default
>   docs: Document the new default sizes of the qcow2 caches
> 
>  block/qcow2.c              | 31 +++++++++++++++++++------------
>  block/qcow2.h              |  4 ----
>  docs/qcow2-cache.txt       | 33 ++++++++++++++++-----------------
>  tests/qemu-iotests/137.out |  2 +-
>  4 files changed, 36 insertions(+), 34 deletions(-)

Thanks, applied to my block-next branch:

https://github.com/XanClic/qemu/commits/block-next

Max