From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: arei.gonglei@huawei.com
Cc: ChenLiang <chenliang88@huawei.com>,
pbonzini@redhat.com, weidong.huang@huawei.com,
qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 06/10] XBZRLE: rebuild the cache_is_cached function
Date: Thu, 20 Mar 2014 17:56:05 +0000 [thread overview]
Message-ID: <20140320175604.GA13386@work-vm> (raw)
In-Reply-To: <1395145464-5524-7-git-send-email-arei.gonglei@huawei.com>
* arei.gonglei@huawei.com (arei.gonglei@huawei.com) wrote:
> From: ChenLiang <chenliang88@huawei.com>
>
> Rebuild the cache_is_cached function by cache_get_by_addr.
>
> Signed-off-by: ChenLiang <chenliang88@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> page_cache.c | 38 ++++++++++++++++----------------------
> 1 file changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/page_cache.c b/page_cache.c
> index c78157b..3190c55 100644
> --- a/page_cache.c
> +++ b/page_cache.c
> @@ -124,24 +124,6 @@ static size_t cache_get_cache_pos(const PageCache *cache,
> return pos;
> }
>
> -bool cache_is_cached(const PageCache *cache, uint64_t addr,
> - uint64_t current_age)
> -{
> - size_t pos;
> -
> - g_assert(cache);
> - g_assert(cache->page_cache);
> -
> - pos = cache_get_cache_pos(cache, addr);
> -
> - if (cache->page_cache[pos].it_addr == addr) {
> - /* update the it_age when the cache hit */
> - cache->page_cache[pos].it_age = current_age;
> - return true;
> - }
> - return false;
> -}
> -
> static CacheItem *cache_get_by_addr(const PageCache *cache, uint64_t addr)
> {
> size_t pos;
> @@ -159,14 +141,26 @@ uint8_t *get_cached_data(const PageCache *cache, uint64_t addr)
> return cache_get_by_addr(cache, addr)->it_data;
> }
>
> +bool cache_is_cached(const PageCache *cache, uint64_t addr,
> + uint64_t current_age)
> +{
> + CacheItem *it;
> +
> + it = cache_get_by_addr(cache, addr);
> +
> + if (it->it_addr == addr) {
> + /* update the it_age when the cache hit */
> + it->it_age = current_age;
> + return true;
> + }
> + return false;
> +}
> +
> int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata,
> uint64_t current_age)
> {
>
> - CacheItem *it = NULL;
> -
> - g_assert(cache);
> - g_assert(cache->page_cache);
> + CacheItem *it;
>
> /* actual update of entry */
> it = cache_get_by_addr(cache, addr);
> --
> 1.7.12.4
>
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2014-03-20 17:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 12:24 [Qemu-devel] [PATCH v3 00/10] migration: Optimizate the xbzrle and fix two corruption issues arei.gonglei
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 01/10] XBZRLE: Fix one XBZRLE " arei.gonglei
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 02/10] migration: Add counters of updating the dirty bitmap arei.gonglei
2014-03-20 19:29 ` Eric Blake
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 03/10] migration: expose the bitmap_sync_counter to the end user arei.gonglei
2014-03-20 19:28 ` Eric Blake
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 04/10] migration: expose xbzrle cache miss rate arei.gonglei
2014-03-20 19:32 ` Eric Blake
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 05/10] XBZRLE: optimize XBZRLE to decrease the cache missing arei.gonglei
2014-03-20 19:43 ` Eric Blake
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 06/10] XBZRLE: rebuild the cache_is_cached function arei.gonglei
2014-03-20 17:56 ` Dr. David Alan Gilbert [this message]
2014-03-20 19:44 ` Eric Blake
2014-03-20 20:09 ` Eric Blake
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 07/10] migration: Fix the migrate auto converge process arei.gonglei
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 08/10] migration: optimize xbzrle by reducing data copy arei.gonglei
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 09/10] migration: clear the dead code arei.gonglei
2014-03-18 12:24 ` [Qemu-devel] [PATCH v3 10/10] XBZRLE: update the doc of XBZRLE arei.gonglei
2014-03-20 19:53 ` Eric Blake
2014-03-20 19:56 ` [Qemu-devel] [PATCH v3 00/10] migration: Optimizate the xbzrle and fix two corruption issues Eric Blake
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=20140320175604.GA13386@work-vm \
--to=dgilbert@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=chenliang88@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=weidong.huang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.