diff options
| author | Yuan Liu <yuan1.liu@intel.com> | 2024-04-01 23:41:10 +0800 |
|---|---|---|
| committer | Peter Xu <peterx@redhat.com> | 2024-04-23 18:36:01 -0400 |
| commit | 5ef7e26bdb7eda10d6d5e1b77121be9945e5e550 (patch) | |
| tree | 8823bbea099cf77e06a48b8d465ff2666c9adf6a /migration/multifd-zero-page.c | |
| parent | dd031677257d7d00a72f28f073befc22691a0ad6 (diff) | |
| download | focaccia-qemu-5ef7e26bdb7eda10d6d5e1b77121be9945e5e550.tar.gz focaccia-qemu-5ef7e26bdb7eda10d6d5e1b77121be9945e5e550.zip | |
migration/multifd: solve zero page causing multiple page faults
Implemented recvbitmap tracking of received pages in multifd. If the zero page appears for the first time in the recvbitmap, this page is not checked and set. If the zero page has already appeared in the recvbitmap, there is no need to check the data but directly set the data to 0, because it is unlikely that the zero page will be migrated multiple times. Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240401154110.2028453-2-yuan1.liu@intel.com [peterx: touch up the comment, as the bitmap is used outside postcopy now] Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration/multifd-zero-page.c')
| -rw-r--r-- | migration/multifd-zero-page.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/migration/multifd-zero-page.c b/migration/multifd-zero-page.c index 1ba38be636..e1b8370f88 100644 --- a/migration/multifd-zero-page.c +++ b/migration/multifd-zero-page.c @@ -80,8 +80,10 @@ void multifd_recv_zero_page_process(MultiFDRecvParams *p) { for (int i = 0; i < p->zero_num; i++) { void *page = p->host + p->zero[i]; - if (!buffer_is_zero(page, p->page_size)) { + if (ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) { memset(page, 0, p->page_size); + } else { + ramblock_recv_bitmap_set_offset(p->block, p->zero[i]); } } } |