qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yanfei Xu <yanfei.xu@bytedance.com>
To: peterx@redhat.com, farosas@suse.de
Cc: qemu-devel@nongnu.org, Yanfei Xu <yanfei.xu@bytedance.com>
Subject: [RFC PATCH] migration/ram: avoid to do log clear in the last round
Date: Wed, 14 May 2025 18:27:33 +0800	[thread overview]
Message-ID: <20250514102733.3114824-1-yanfei.xu@bytedance.com> (raw)

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>
---
As I don't have proper machine to test this patch in qemu and verify if it has
risks like in postcopy, colo and so on.(But I tested this idea on my rust VMM,
it works and can reduce ~50ms for a 128GB guest). So I raise the patch with RFC
for suggestions.

 migration/ram.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/migration/ram.c b/migration/ram.c
index e12913b43e..2b169cdd18 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -838,7 +838,9 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,
      * 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);
+    if (!rs->last_stage) {
+        migration_clear_memory_region_dirty_bitmap(rb, page);
+    }
 
     ret = test_and_clear_bit(page, rb->bmap);
     if (ret) {
-- 
2.20.1



             reply	other threads:[~2025-05-14 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 10:27 Yanfei Xu [this message]
2025-05-14 14:25 ` [RFC PATCH] migration/ram: avoid to do log clear in the last round Yanfei Xu
  -- strict thread matches above, loose matches on Subject: below --
2025-05-14 11:58 Yanfei Xu
2025-05-20 19:05 ` Fabiano Rosas
2025-05-20 20:33   ` Peter Xu
2025-05-21  3:09     ` Yanfei Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250514102733.3114824-1-yanfei.xu@bytedance.com \
    --to=yanfei.xu@bytedance.com \
    --cc=farosas@suse.de \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).