[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v9 01/10] Add cache handling functions
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH v9 01/10] Add cache handling functions |
Date: |
Wed, 18 Apr 2012 19:44:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) |
Orit Wasserman <address@hidden> wrote:
> On 04/18/2012 05:34 PM, Juan Quintela wrote:
>>> + assert(cache_num_buckets);
>>> + DPRINTF("Setting cache buckets to %lu\n", cache_num_buckets);
>>> +
>>> + assert(!page_cache);
>>
>> Only user of this function make page_cache = NULL before calling.
>> Returning an error looks more sensible, but haven't yet looked at the
>> next patechs to see if we have a way to do anything good with the error.
>
> I guess we can fail the migration in case of an error.
>
Yeap.
>>> +void cache_resize(int64_t new_size)
>>> +{
>>> + int64_t new_num_buckets = new_size/(TARGET_PAGE_SIZE * CACHE_N_WAY);
>>> + CacheBucket *old_page_cache = page_cache;
>>> + int i;
>>> + int64_t old_num_buckets = cache_num_buckets;
>>> +
>>> + /* same size */
>>> + if (new_num_buckets == cache_num_buckets) {
>>> + return;
>>> + }
>>
>> Shouldn't we check that new_num_buckets makes sense?
>
> The checks are done in the calling function (patch 9) . Do you think I
> should move them here ?
I think they are not. But what I mean is that they need to be done in
one place. probably in patch 9 is a better place.
Later, Juan.