[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RESEND for 2.3 6/6] migration: clear the dead code
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH RESEND for 2.3 6/6] migration: clear the dead code |
Date: |
Mon, 24 Nov 2014 19:55:52 +0800 |
From: ChenLiang <address@hidden>
clear the dead code
Signed-off-by: ChenLiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
---
arch_init.c | 12 ------------
page_cache.c | 58 ----------------------------------------------------------
2 files changed, 70 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 0d0ba4a..5d31def 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -167,8 +167,6 @@ 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;
@@ -750,10 +748,8 @@ static void migration_end(void)
if (XBZRLE.cache) {
cache_fini(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();
}
@@ -803,14 +799,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) {
- error_report("Error allocating current_buf");
- g_free(XBZRLE.encoded_buf);
- XBZRLE.encoded_buf = NULL;
- return -1;
- }
-
acct_clear();
}
diff --git a/page_cache.c b/page_cache.c
index cf8878d..c0ce00b 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);
@@ -188,59 +186,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
- [Qemu-devel] [PATCH RESEND for 2.3 0/6] xbzrle: optimize the xbzrle, arei.gonglei, 2014/11/24
- [Qemu-devel] [PATCH RESEND for 2.3 6/6] migration: clear the dead code,
arei.gonglei <=
- [Qemu-devel] [PATCH RESEND for 2.3 5/6] migration: optimize xbzrle by reducing data copy, arei.gonglei, 2014/11/24
- [Qemu-devel] [PATCH RESEND for 2.3 1/6] xbzrle: optimize XBZRLE to decrease the cache misses, arei.gonglei, 2014/11/24
- [Qemu-devel] [PATCH RESEND for 2.3 3/6] xbzrle: don't check the value in the vm ram repeatedly, arei.gonglei, 2014/11/24
- [Qemu-devel] [PATCH RESEND for 2.3 2/6] xbzrle: rebuild the cache_is_cached function, arei.gonglei, 2014/11/24
- [Qemu-devel] [PATCH RESEND for 2.3 4/6] xbzrle: check 8 bytes at a time after an concurrency scene, arei.gonglei, 2014/11/24