diff options
author | Yanfei Xu <yanfei.xu@bytedance.com> | 2025-05-14 19:58:27 +0800 |
---|---|---|
committer | Peter Xu <peterx@redhat.com> | 2025-06-23 16:03:59 -0400 |
commit | fd0377150d5dd4b02b2e7fbe9e8c1ab4dcbd16bb (patch) | |
tree | 9ddb8f737cb60c9592a98dae554267b907f43dc0 | |
parent | 43ba160cb4bbb193560eb0d2d7decc4b5fc599fe (diff) | |
download | qemu-fd0377150d5dd4b02b2e7fbe9e8c1ab4dcbd16bb.zip qemu-fd0377150d5dd4b02b2e7fbe9e8c1ab4dcbd16bb.tar.gz qemu-fd0377150d5dd4b02b2e7fbe9e8c1ab4dcbd16bb.tar.bz2 |
migration/ram: avoid to do log clear in the last round
There won't be any ram sync after the stage of save_complete, therefore
it's unnecessary to do manually protect for dirty pages being sent. Skip
to do this in last round can reduce noticeable downtime.
Signed-off-by: Yanfei Xu <yanfei.xu@bytedance.com>
Tested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20250514115827.3216082-1-yanfei.xu@bytedance.com
[peterx: add comments]
Signed-off-by: Peter Xu <peterx@redhat.com>
-rw-r--r-- | migration/ram.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/migration/ram.c b/migration/ram.c index d26dbd3..fd8d83b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -831,14 +831,22 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs, bool ret; /* - * Clear dirty bitmap if needed. This _must_ be called before we - * send any of the page in the chunk because we need to make sure - * we can capture further page content changes when we sync dirty - * log the next time. So as long as we are going to send any of - * the page in the chunk we clear the remote dirty bitmap for all. - * Clearing it earlier won't be a problem, but too late will. + * During the last stage (after source VM stopped), resetting the write + * protections isn't needed as we know there will be either (1) no + * further writes if migration will complete, or (2) migration fails + * at last then tracking isn't needed either. */ - migration_clear_memory_region_dirty_bitmap(rb, page); + if (!rs->last_stage) { + /* + * Clear dirty bitmap if needed. This _must_ be called before we + * send any of the page in the chunk because we need to make sure + * we can capture further page content changes when we sync dirty + * log the next time. So as long as we are going to send any of + * the page in the chunk we clear the remote dirty bitmap for all. + * Clearing it earlier won't be a problem, but too late will. + */ + migration_clear_memory_region_dirty_bitmap(rb, page); + } ret = test_and_clear_bit(page, rb->bmap); if (ret) { |