[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 2/7] migration/multifd: Allow clearing of the file_bmap from m
From: |
Hao Xiang |
Subject: |
[PATCH v5 2/7] migration/multifd: Allow clearing of the file_bmap from multifd |
Date: |
Sat, 9 Mar 2024 07:57:23 +0000 |
From: Fabiano Rosas <farosas@suse.de>
We currently only need to clear the mapped-ram file bitmap from the
migration thread during save_zero_page.
We're about to add support for zero page detection on the multifd
thread, so allow ramblock_set_file_bmap_atomic() to also clear the
bits.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/multifd.c | 2 +-
migration/ram.c | 8 ++++++--
migration/ram.h | 3 ++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index d4a44da559..6b8a78e4ca 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -115,7 +115,7 @@ static void multifd_set_file_bitmap(MultiFDSendParams *p)
assert(pages->block);
for (int i = 0; i < p->pages->num; i++) {
- ramblock_set_file_bmap_atomic(pages->block, pages->offset[i]);
+ ramblock_set_file_bmap_atomic(pages->block, pages->offset[i], true);
}
}
diff --git a/migration/ram.c b/migration/ram.c
index 003c28e133..f4abc47bbf 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3150,9 +3150,13 @@ static void ram_save_file_bmap(QEMUFile *f)
}
}
-void ramblock_set_file_bmap_atomic(RAMBlock *block, ram_addr_t offset)
+void ramblock_set_file_bmap_atomic(RAMBlock *block, ram_addr_t offset, bool
set)
{
- set_bit_atomic(offset >> TARGET_PAGE_BITS, block->file_bmap);
+ if (set) {
+ set_bit_atomic(offset >> TARGET_PAGE_BITS, block->file_bmap);
+ } else {
+ clear_bit_atomic(offset >> TARGET_PAGE_BITS, block->file_bmap);
+ }
}
/**
diff --git a/migration/ram.h b/migration/ram.h
index b9ac0da587..08feecaf51 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -75,7 +75,8 @@ bool ram_dirty_bitmap_reload(MigrationState *s, RAMBlock *rb,
Error **errp);
bool ramblock_page_is_discarded(RAMBlock *rb, ram_addr_t start);
void postcopy_preempt_shutdown_file(MigrationState *s);
void *postcopy_preempt_thread(void *opaque);
-void ramblock_set_file_bmap_atomic(RAMBlock *block, ram_addr_t offset);
+void ramblock_set_file_bmap_atomic(RAMBlock *block, ram_addr_t offset,
+ bool set);
/* ram cache */
int colo_init_ram_cache(void);
--
2.30.2
- [PATCH v5 0/7] Introduce multifd zero page checking., Hao Xiang, 2024/03/09
- [PATCH v5 2/7] migration/multifd: Allow clearing of the file_bmap from multifd,
Hao Xiang <=
- [PATCH v5 1/7] migration/multifd: Allow zero pages in file migration, Hao Xiang, 2024/03/09
- [PATCH v5 3/7] migration/multifd: Add new migration option zero-page-detection., Hao Xiang, 2024/03/09
- [PATCH v5 4/7] migration/multifd: Implement zero page transmission on the multifd thread., Hao Xiang, 2024/03/09
- [PATCH v5 5/7] migration/multifd: Implement ram_save_target_page_multifd to handle multifd version of MigrationOps::ram_save_target_page., Hao Xiang, 2024/03/09
- [PATCH v5 6/7] migration/multifd: Enable multifd zero page checking by default., Hao Xiang, 2024/03/09
- [PATCH v5 7/7] migration/multifd: Add new migration test cases for legacy zero page checking., Hao Xiang, 2024/03/09