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
Then the caller ensures that it's always set to the minimum (as it did
with the previous code).