aboutsummaryrefslogtreecommitdiff
path: root/migration/qemu-file.h
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@tencent.com>2018-03-30 15:51:20 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-04-25 18:04:06 +0100
commitdcaf446ebda5d87e05eb41cdbafb7ae4a7cc4a62 (patch)
tree4b798711f89fc9803ad553b521d0d26b68958351 /migration/qemu-file.h
parent263a289ae61c8344a417a95b0142650fdff3af56 (diff)
downloadqemu-dcaf446ebda5d87e05eb41cdbafb7ae4a7cc4a62.zip
qemu-dcaf446ebda5d87e05eb41cdbafb7ae4a7cc4a62.tar.gz
qemu-dcaf446ebda5d87e05eb41cdbafb7ae4a7cc4a62.tar.bz2
migration: stop compression to allocate and free memory frequently
Current code uses compress2() to compress memory which manages memory internally, that causes huge memory is allocated and freed very frequently More worse, frequently returning memory to kernel will flush TLBs and trigger invalidation callbacks on mmu-notification which interacts with KVM MMU, that dramatically reduce the performance of VM So, we maintain the memory by ourselves and reuse it for each compression Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn> Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com> Message-Id: <20180330075128.26919-3-xiaoguangrong@tencent.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/qemu-file.h')
-rw-r--r--migration/qemu-file.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index f4f356a..2ccfcfb 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -25,6 +25,8 @@
#ifndef MIGRATION_QEMU_FILE_H
#define MIGRATION_QEMU_FILE_H
+#include <zlib.h>
+
/* Read a chunk of data from a file at the given position. The pos argument
* can be ignored if the file is only be used for streaming. The number of
* bytes actually read should be returned.
@@ -132,8 +134,8 @@ bool qemu_file_is_writable(QEMUFile *f);
size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset);
size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size);
-ssize_t qemu_put_compression_data(QEMUFile *f, const uint8_t *p, size_t size,
- int level);
+ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
+ const uint8_t *p, size_t size);
int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src);
/*