[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/10] migraion: clear the death code
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH 07/10] migraion: clear the death code |
Date: |
Tue, 11 Mar 2014 20:53:32 +0800 |
From: ChenLiang <address@hidden>
Clear the death code
Signed-off-by: ChenLiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
arch_init.c | 13 -------------
page_cache.c | 58 ----------------------------------------------------------
2 files changed, 71 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 7ef3ebb..461a10a 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -178,14 +178,11 @@ static inline bool is_zero_range(uint8_t *p, uint64_t
size)
static struct {
/* buffer used for XBZRLE encoding */
uint8_t *encoded_buf;
- /* buffer for storing page content */
- uint8_t *current_buf;
/* Cache for XBZRLE, Protected by lock. */
PageCache *cache;
QemuMutex lock;
} XBZRLE = {
.encoded_buf = NULL,
- .current_buf = NULL,
.cache = NULL,
};
/* buffer used for XBZRLE decoding */
@@ -702,10 +699,8 @@ static void migration_end(void)
cache_fini(XBZRLE.cache);
g_free(XBZRLE.cache);
g_free(XBZRLE.encoded_buf);
- g_free(XBZRLE.current_buf);
XBZRLE.cache = NULL;
XBZRLE.encoded_buf = NULL;
- XBZRLE.current_buf = NULL;
}
XBZRLE_cache_unlock();
}
@@ -757,14 +752,6 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
return -1;
}
- XBZRLE.current_buf = g_try_malloc(TARGET_PAGE_SIZE);
- if (!XBZRLE.current_buf) {
- DPRINTF("Error allocating current_buf\n");
- g_free(XBZRLE.encoded_buf);
- XBZRLE.encoded_buf = NULL;
- return -1;
- }
-
acct_clear();
}
diff --git a/page_cache.c b/page_cache.c
index 6fc4334..579330c 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -48,7 +48,6 @@ struct PageCache {
CacheItem *page_cache;
unsigned int page_size;
int64_t max_num_items;
- uint64_t max_item_age;
int64_t num_items;
};
@@ -76,7 +75,6 @@ PageCache *cache_init(int64_t num_pages, unsigned int
page_size)
}
cache->page_size = page_size;
cache->num_items = 0;
- cache->max_item_age = 0;
cache->max_num_items = num_pages;
DPRINTF("Setting cache buckets to %" PRId64 "\n", cache->max_num_items);
@@ -190,59 +188,3 @@ int cache_insert(PageCache *cache, uint64_t addr, const
uint8_t *pdata,
return 0;
}
-
-int64_t cache_resize(PageCache *cache, int64_t new_num_pages)
-{
- PageCache *new_cache;
- int64_t i;
-
- CacheItem *old_it, *new_it;
-
- g_assert(cache);
-
- /* cache was not inited */
- if (cache->page_cache == NULL) {
- return -1;
- }
-
- /* same size */
- if (pow2floor(new_num_pages) == cache->max_num_items) {
- return cache->max_num_items;
- }
-
- new_cache = cache_init(new_num_pages, cache->page_size);
- if (!(new_cache)) {
- DPRINTF("Error creating new cache\n");
- return -1;
- }
-
- /* move all data from old cache */
- for (i = 0; i < cache->max_num_items; i++) {
- old_it = &cache->page_cache[i];
- if (old_it->it_addr != -1) {
- /* check for collision, if there is, keep MRU page */
- new_it = cache_get_by_addr(new_cache, old_it->it_addr);
- if (new_it->it_data && new_it->it_age >= old_it->it_age) {
- /* keep the MRU page */
- g_free(old_it->it_data);
- } else {
- if (!new_it->it_data) {
- new_cache->num_items++;
- }
- g_free(new_it->it_data);
- new_it->it_data = old_it->it_data;
- new_it->it_age = old_it->it_age;
- new_it->it_addr = old_it->it_addr;
- }
- }
- }
-
- g_free(cache->page_cache);
- cache->page_cache = new_cache->page_cache;
- cache->max_num_items = new_cache->max_num_items;
- cache->num_items = new_cache->num_items;
-
- g_free(new_cache);
-
- return cache->max_num_items;
-}
--
1.7.12.4
- Re: [Qemu-devel] [PATCH 06/10] migraion: optimiztion xbzrle by reducing data copy, (continued)
- [Qemu-devel] [PATCH 05/10] migration: Fix the migrate auto converge process, arei.gonglei, 2014/03/11
- [Qemu-devel] [PATCH 03/10] XBZRLE: optimize XBZRLE to decrease the cache missing, arei.gonglei, 2014/03/11
- [Qemu-devel] [PATCH 09/10] migration: expose the bitmap_sync_cnt to the end user, arei.gonglei, 2014/03/11
- [Qemu-devel] [PATCH 07/10] migraion: clear the death code,
arei.gonglei <=
- [Qemu-devel] [PATCH 08/10] migration: s/uint64_t/int64_t the definitions of it_age, arei.gonglei, 2014/03/11
- [Qemu-devel] [PATCH 10/10] XBZRLE: update the doc of XBZRLE, arei.gonglei, 2014/03/11
- [Qemu-devel] [PATCH 02/10] migration: Add counters of updating the dirty bitmap, arei.gonglei, 2014/03/11