mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
migration/multifd: Implement zero page transmission on the multifd thread.
1. Add zero_pages field in MultiFDPacket_t. 2. Implements the zero page detection and handling on the multifd threads for non-compression, zlib and zstd compression backends. 3. Added a new value 'multifd' in ZeroPageDetection enumeration. 4. Adds zero page counters and updates multifd send/receive tracing format to track the newly added counters. Signed-off-by: Hao Xiang <hao.xiang@bytedance.com> Acked-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240311180015.3359271-5-hao.xiang@linux.dev Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
5fdbb1dfcc
commit
303e6f54f9
10 changed files with 228 additions and 32 deletions
|
@ -123,13 +123,15 @@ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
|||
int ret;
|
||||
uint32_t i;
|
||||
|
||||
multifd_send_prepare_header(p);
|
||||
if (!multifd_send_prepare_common(p)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < pages->num; i++) {
|
||||
for (i = 0; i < pages->normal_num; i++) {
|
||||
uint32_t available = z->zbuff_len - out_size;
|
||||
int flush = Z_NO_FLUSH;
|
||||
|
||||
if (i == pages->num - 1) {
|
||||
if (i == pages->normal_num - 1) {
|
||||
flush = Z_SYNC_FLUSH;
|
||||
}
|
||||
|
||||
|
@ -172,10 +174,10 @@ static int zlib_send_prepare(MultiFDSendParams *p, Error **errp)
|
|||
p->iov[p->iovs_num].iov_len = out_size;
|
||||
p->iovs_num++;
|
||||
p->next_packet_size = out_size;
|
||||
|
||||
out:
|
||||
p->flags |= MULTIFD_FLAG_ZLIB;
|
||||
|
||||
multifd_send_fill_packet(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -261,6 +263,14 @@ static int zlib_recv(MultiFDRecvParams *p, Error **errp)
|
|||
p->id, flags, MULTIFD_FLAG_ZLIB);
|
||||
return -1;
|
||||
}
|
||||
|
||||
multifd_recv_zero_page_process(p);
|
||||
|
||||
if (!p->normal_num) {
|
||||
assert(in_size == 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = qio_channel_read_all(p->c, (void *)z->zbuff, in_size, errp);
|
||||
|
||||
if (ret != 0) {
|
||||
|
@ -310,6 +320,7 @@ static int zlib_recv(MultiFDRecvParams *p, Error **errp)
|
|||
p->id, out_size, expected_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue