[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [v3 06/13] arch_init: Add data struct used by decompression
From: |
Liang Li |
Subject: |
[Qemu-devel] [v3 06/13] arch_init: Add data struct used by decompression |
Date: |
Fri, 12 Dec 2014 09:28:59 +0800 |
Define the data structure and varibles used when doing multiple
thread decompression, and add the code to initialize and free them.
Signed-off-by: Liang Li <address@hidden>
Signed-off-by: Yang Zhang <address@hidden>
---
arch_init.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch_init.c b/arch_init.c
index f21a8ea..71cc756 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -355,7 +355,12 @@ enum {
};
struct decompress_param {
- /* To be done */
+ int state;
+ QemuMutex mutex;
+ QemuCond cond;
+ void *des;
+ uint8 compbuf[COMPRESS_BUF_SIZE];
+ int len;
};
typedef struct decompress_param decompress_param;
@@ -1186,6 +1191,8 @@ void migrate_decompress_threads_create(int count)
decomp_param = g_malloc0(sizeof(decompress_param) * count);
quit_thread = false;
for (i = 0; i < count; i++) {
+ qemu_mutex_init(&decomp_param[i].mutex);
+ qemu_cond_init(&decomp_param[i].cond);
qemu_thread_create(decompress_threads + i, "decompress",
do_data_decompress, decomp_param + i, QEMU_THREAD_JOINABLE);
}
@@ -1199,6 +1206,8 @@ void migrate_decompress_threads_join(void)
thread_count = migrate_decompress_threads();
for (i = 0; i < thread_count; i++) {
qemu_thread_join(decompress_threads + i);
+ qemu_mutex_destroy(&decomp_param[i].mutex);
+ qemu_cond_destroy(&decomp_param[i].cond);
}
g_free(decompress_threads);
g_free(decomp_param);
--
1.8.3.1
- [Qemu-devel] [PATCH v3 0/13] migration: Add a new feature to do live migration, Liang Li, 2014/12/11
- [Qemu-devel] [v3 01/13] docs: Add a doc about multiple thread compression, Liang Li, 2014/12/11
- [Qemu-devel] [v3 04/13] qemu-file: Add tow function will be used in migration, Liang Li, 2014/12/11
- [Qemu-devel] [v3 05/13] arch_init: alloc and free data struct in multi-thread compression, Liang Li, 2014/12/11
- [Qemu-devel] [v3 02/13] migration: Add the framework of multi-thread compression, Liang Li, 2014/12/11
- [Qemu-devel] [v3 06/13] arch_init: Add data struct used by decompression,
Liang Li <=
- [Qemu-devel] [v3 03/13] migration: Add the framework of muti-thread decompression, Liang Li, 2014/12/11
- [Qemu-devel] [v3 07/13] migraion: Rewrite the function ram_save_page(), Liang Li, 2014/12/11
- [Qemu-devel] [v3 08/13] migration: Add the core code of multi-thread compresion, Liang Li, 2014/12/11
- [Qemu-devel] [v3 09/13] migration: Make compression co-work with xbzrle, Liang Li, 2014/12/11
- [Qemu-devel] [v3 10/13] migration: Add the core code of multi-thread decompression, Liang Li, 2014/12/11
- [Qemu-devel] [v3 11/13] migration: Add interface to control compression, Liang Li, 2014/12/11
- [Qemu-devel] [v3 12/13] migration: Add command to set migration parameter, Liang Li, 2014/12/11
- [Qemu-devel] [v3 13/13] migration: Add command to query migration parameter, Liang Li, 2014/12/11
- Re: [Qemu-devel] [PATCH v3 0/13] migration: Add a new feature to do live migration, Li, Liang Z, 2014/12/24