qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] qcow2: Give the refcount cache the minimum


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/2] qcow2: Give the refcount cache the minimum possible size by default
Date: Tue, 13 Mar 2018 14:10:40 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 03/13/2018 01:48 PM, Alberto Garcia wrote:
On Tue 13 Mar 2018 07:23:36 PM CET, Eric Blake wrote:
+                *refcount_cache_size =
+                    MIN(combined_cache_size, min_refcount_cache);

but here, if combined_cache_size is smaller than min_refcount_cache,

+                *l2_cache_size = combined_cache_size - *refcount_cache_size;

then l2_cache_size is set to a negative value.

No, it's set to 0.

If combined == 4k and min_refcount == 256, then

    refcount_cache_size = MIN(4k, 256k) // 4k
    l2_cache_size = 4k - 4k; // 0

Ah. Mental breakdown on my part in trying to compute (x - MIN()).


Then the caller ensures that it's always set to the minimum (as it did
with the previous code).

So the caller will use larger than the requested limits if the requested limits are too small, and we are okay with calculations resulting in 0 here. All right, thanks for stepping me through my error; you're good to go with:

Reviewed-by: Eric Blake <address@hidden>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]