mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43: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
|
@ -55,14 +55,24 @@ typedef struct {
|
|||
/* size of the next packet that contains pages */
|
||||
uint32_t next_packet_size;
|
||||
uint64_t packet_num;
|
||||
uint64_t unused[4]; /* Reserved for future use */
|
||||
/* zero pages */
|
||||
uint32_t zero_pages;
|
||||
uint32_t unused32[1]; /* Reserved for future use */
|
||||
uint64_t unused64[3]; /* Reserved for future use */
|
||||
char ramblock[256];
|
||||
/*
|
||||
* This array contains the pointers to:
|
||||
* - normal pages (initial normal_pages entries)
|
||||
* - zero pages (following zero_pages entries)
|
||||
*/
|
||||
uint64_t offset[];
|
||||
} __attribute__((packed)) MultiFDPacket_t;
|
||||
|
||||
typedef struct {
|
||||
/* number of used pages */
|
||||
uint32_t num;
|
||||
/* number of normal pages */
|
||||
uint32_t normal_num;
|
||||
/* number of allocated pages */
|
||||
uint32_t allocated;
|
||||
/* offset of each page */
|
||||
|
@ -136,6 +146,8 @@ typedef struct {
|
|||
uint64_t packets_sent;
|
||||
/* non zero pages sent through this channel */
|
||||
uint64_t total_normal_pages;
|
||||
/* zero pages sent through this channel */
|
||||
uint64_t total_zero_pages;
|
||||
/* buffers to send */
|
||||
struct iovec *iov;
|
||||
/* number of iovs used */
|
||||
|
@ -194,12 +206,18 @@ typedef struct {
|
|||
uint8_t *host;
|
||||
/* non zero pages recv through this channel */
|
||||
uint64_t total_normal_pages;
|
||||
/* zero pages recv through this channel */
|
||||
uint64_t total_zero_pages;
|
||||
/* buffers to recv */
|
||||
struct iovec *iov;
|
||||
/* Pages that are not zero */
|
||||
ram_addr_t *normal;
|
||||
/* num of non zero pages */
|
||||
uint32_t normal_num;
|
||||
/* Pages that are zero */
|
||||
ram_addr_t *zero;
|
||||
/* num of zero pages */
|
||||
uint32_t zero_num;
|
||||
/* used for de-compression methods */
|
||||
void *compress_data;
|
||||
} MultiFDRecvParams;
|
||||
|
@ -221,6 +239,9 @@ typedef struct {
|
|||
|
||||
void multifd_register_ops(int method, MultiFDMethods *ops);
|
||||
void multifd_send_fill_packet(MultiFDSendParams *p);
|
||||
bool multifd_send_prepare_common(MultiFDSendParams *p);
|
||||
void multifd_send_zero_page_detect(MultiFDSendParams *p);
|
||||
void multifd_recv_zero_page_process(MultiFDRecvParams *p);
|
||||
|
||||
static inline void multifd_send_prepare_header(MultiFDSendParams *p)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue