qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: guangrong.xiao@gmail.com
To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, dgilbert@redhat.com,
	peterx@redhat.com, jiang.biao2@zte.com.cn, wei.w.wang@intel.com,
	Xiao Guangrong <xiaoguangrong@tencent.com>
Subject: [Qemu-devel] [PATCH v3 07/10] migration: move calling control_save_page to the common place
Date: Fri, 30 Mar 2018 15:51:25 +0800	[thread overview]
Message-ID: <20180330075128.26919-8-xiaoguangrong@tencent.com> (raw)
In-Reply-To: <20180330075128.26919-1-xiaoguangrong@tencent.com>

From: Xiao Guangrong <xiaoguangrong@tencent.com>

The function is called by both ram_save_page and ram_save_target_page,
so move it to the common caller to cleanup the code

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
---
 migration/ram.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index c3628b020e..e0caf7182b 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1037,10 +1037,6 @@ static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage)
     p = block->host + offset;
     trace_ram_save_page(block->idstr, (uint64_t)offset, p);
 
-    if (control_save_page(rs, block, offset, &pages)) {
-        return pages;
-    }
-
     XBZRLE_cache_lock();
     pages = save_zero_page(rs, block, offset);
     if (pages > 0) {
@@ -1198,10 +1194,6 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
 
     p = block->host + offset;
 
-    if (control_save_page(rs, block, offset, &pages)) {
-        return pages;
-    }
-
     /* When starting the process of a new block, the first page of
      * the block should be sent out before other pages in the same
      * block, and all the pages in last block should have been sent
@@ -1489,6 +1481,14 @@ err:
 static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
                                 bool last_stage)
 {
+    RAMBlock *block = pss->block;
+    ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
+    int res;
+
+    if (control_save_page(rs, block, offset, &res)) {
+        return res;
+    }
+
     /*
      * If xbzrle is on, stop using the data compression after first
      * round of migration even if compression is enabled. In theory,
-- 
2.14.3

  parent reply	other threads:[~2018-03-30  7:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30  7:51 [Qemu-devel] [PATCH v3 00/10] migration: improve and cleanup compression guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 01/10] migration: stop compressing page in migration thread guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 02/10] migration: stop compression to allocate and free memory frequently guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 03/10] migration: stop decompression " guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 04/10] migration: detect compression and decompression errors guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 05/10] migration: introduce control_save_page() guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 06/10] migration: move some code to ram_save_host_page guangrong.xiao
2018-03-30  7:51 ` guangrong.xiao [this message]
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 08/10] migration: move calling save_zero_page to the common place guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 09/10] migration: introduce save_normal_page() guangrong.xiao
2018-03-30  7:51 ` [Qemu-devel] [PATCH v3 10/10] migration: remove ram_save_compressed_page() guangrong.xiao
2018-03-31  8:22 ` [Qemu-devel] [PATCH v3 00/10] migration: improve and cleanup compression no-reply
2018-04-08  3:19 ` Xiao Guangrong
2018-04-09  9:17   ` Paolo Bonzini
2018-04-09 19:30     ` Dr. David Alan Gilbert
2018-04-25 17:04 ` Dr. David Alan Gilbert

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=20180330075128.26919-8-xiaoguangrong@tencent.com \
    --to=guangrong.xiao@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=jiang.biao2@zte.com.cn \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.w.wang@intel.com \
    --cc=xiaoguangrong@tencent.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).