From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 8/8] docs: document how to configure the qcow2 L2/refcount caches
Date: Mon, 11 May 2015 16:08:05 +0200 [thread overview]
Message-ID: <5550B7C5.3000604@redhat.com> (raw)
In-Reply-To: <w51mw1b1bst.fsf@maestria.local.igalia.com>
On 11.05.2015 15:30, Alberto Garcia wrote:
> On Mon 11 May 2015 03:23:25 PM CEST, Max Reitz <mreitz@redhat.com> wrote:
>
>>> + disk_size = l2_cache_size * cluster_size / 8
>>> + disk_size = refcount_cache_size * cluster_size / 2
>> Only with the default of refcount_bits=16. In the general case, it's
>> refcount_cache_size * cluster_size * 8 / refcount_bits.
> I actually omitted that on purpose because I didn't want to go into too
> many details and I hadn't realized that it's now possible to configure
> refcount_bits. I will correct the document.
>
> I wonder what happens then to this DEFAULT_L2_REFCOUNT_SIZE_RATIO of 4,
> because that's only valid if refcount_bits == 16.
>
> Is the user supposed to calculate that ratio manually and configure both
> cache sizes?
Well... Considering nobody will probably ever use refcount_bits > 16, we
don't need to worry about 4 being too big of a ratio. And I think, for
cases of refcount_bits < 16, we wouldn't really save as much to justify
adjusting the ratio. So while it would be possible to make qcow2 choose
a variable ratio based on refcount_bits, I don't think we really need to
care about it.
But as for the user, I do think they should care about it, or at least
know about it. If they are already adjusting the cache sizes manually,
they should know exactly what the ratio should be. For justifying why
qemu does not adjust its default ratio, I think it's enough to write
that that default ratio (4) is geared towards the default value of
refcount_bits (16) and that should be enough.
If we do decide to implement a variable ratio later on, we can still
change this documentation.
Oh, and also note that the "range covered" by the metadata caches are
different things: For the L2 tables, it's a guest offset range, while
for the refblocks it's a host offset range. Also, you basically only
need the refcounts for allocating clusters and doing internal snapshot
operations (you don't need them for reads, and you don't need them for
non-allocating writes, thanks to the O_COPIED flag), so it would
actually make sense for the user to choose a ratio larger than 64 /
refcount_bits because refcounts are (1) rarely ever needed, and (2) when
they are needed, they are most likely for allocation, which most likely
will occur at the image's end (unless you're using internal snapshots or
you're manually discarding things), so you actually only need to cache
the refblock covering the image end.
Max
>
>> Apart from this minor thing, looks good. Well, except that maybe it
>> should be preferred to use .qcow2 as the extension for qcow2 files
>> (instead of .img).
> Sure, I can change that too.
>
> Berto
next prev parent reply other threads:[~2015-05-11 14:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 12:54 [Qemu-devel] [PATCH v3 0/8] qcow2 L2/refcount cache improvements Alberto Garcia
2015-05-11 12:54 ` [Qemu-devel] [PATCH 1/8] qcow2: use one single memory block for the L2/refcount cache tables Alberto Garcia
2015-05-11 12:54 ` [Qemu-devel] [PATCH 2/8] qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty() Alberto Garcia
2015-05-11 12:54 ` [Qemu-devel] [PATCH 3/8] qcow2: use an LRU algorithm to replace entries from the L2 cache Alberto Garcia
2015-05-11 12:54 ` [Qemu-devel] [PATCH 4/8] qcow2: remove qcow2_cache_find_entry_to_replace() Alberto Garcia
2015-05-11 12:54 ` [Qemu-devel] [PATCH 5/8] qcow2: use a hash to look for entries in the L2 cache Alberto Garcia
2015-05-11 12:54 ` [Qemu-devel] [PATCH 6/8] qcow2: make qcow2_cache_put() a void function Alberto Garcia
2015-05-11 13:12 ` Max Reitz
2015-05-11 12:54 ` [Qemu-devel] [PATCH 7/8] qcow2: style fixes in qcow2-cache.c Alberto Garcia
2015-05-11 12:55 ` [Qemu-devel] [PATCH 8/8] docs: document how to configure the qcow2 L2/refcount caches Alberto Garcia
2015-05-11 13:23 ` Max Reitz
2015-05-11 13:30 ` Alberto Garcia
2015-05-11 14:08 ` Max Reitz [this message]
2015-05-11 15:12 ` Eric Blake
2015-05-12 9:57 ` [Qemu-devel] [PATCH v3 0/8] qcow2 L2/refcount cache improvements Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5550B7C5.3000604@redhat.com \
--to=mreitz@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).