Skip to content

Commit

Permalink
migration/multifd: Fix clearing of mapped-ram zero pages
Browse files Browse the repository at this point in the history
When the zero page detection is done in the multifd threads, we need
to iterate the second part of the pages->offset array and clear the
file bitmap for each zero page. The piece of code we merged to do that
is wrong.

The reason this has passed all the tests is because the bitmap is
initialized with zeroes already, so clearing the bits only really has
an effect during live migration and when a data page goes from having
data to no data.

Fixes: 303e6f5 ("migration/multifd: Implement zero page transmission on the multifd thread.")
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20240321201242.6009-1-farosas@suse.de
Signed-off-by: Peter Xu <peterx@redhat.com>
  • Loading branch information
Fabiano Rosas authored and xzpeter committed Mar 22, 2024
1 parent 910c164 commit 8fa1a21
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions migration/multifd.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,14 @@ void multifd_send_channel_created(void)
static void multifd_set_file_bitmap(MultiFDSendParams *p)
{
MultiFDPages_t *pages = p->pages;
uint32_t zero_num = p->pages->num - p->pages->normal_num;

assert(pages->block);

for (int i = 0; i < p->pages->normal_num; i++) {
ramblock_set_file_bmap_atomic(pages->block, pages->offset[i], true);
}

for (int i = p->pages->num; i < zero_num; i++) {
for (int i = p->pages->normal_num; i < p->pages->num; i++) {
ramblock_set_file_bmap_atomic(pages->block, pages->offset[i], false);
}
}
Expand Down

0 comments on commit 8fa1a21

Please sign in to comment.