qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Yanfei Xu <yanfei.xu@bytedance.com>, peterx@redhat.com
Cc: qemu-devel@nongnu.org, Yanfei Xu <yanfei.xu@bytedance.com>
Subject: Re: [RFC PATCH] migration/ram: avoid to do log clear in the last round
Date: Tue, 20 May 2025 16:05:57 -0300	[thread overview]
Message-ID: <87zff75ch6.fsf@suse.de> (raw)
In-Reply-To: <20250514115827.3216082-1-yanfei.xu@bytedance.com>

Yanfei Xu <yanfei.xu@bytedance.com> writes:

> 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) {

Well, it looks ok to me and passes all my tests.

Tested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Fabiano Rosas <farosas@suse.de>


  reply	other threads:[~2025-05-20 19:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 11:58 [RFC PATCH] migration/ram: avoid to do log clear in the last round Yanfei Xu
2025-05-20 19:05 ` Fabiano Rosas [this message]
2025-05-20 20:33   ` Peter Xu
2025-05-21  3:09     ` Yanfei Xu
  -- strict thread matches above, loose matches on Subject: below --
2025-05-14 10:27 Yanfei Xu
2025-05-14 14:25 ` 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=87zff75ch6.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yanfei.xu@bytedance.com \
    /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).