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 v2 10/10] migration: remove ram_save_compressed_page()
Date: Tue, 27 Mar 2018 17:10:43 +0800 [thread overview]
Message-ID: <20180327091043.30220-11-xiaoguangrong@tencent.com> (raw)
In-Reply-To: <20180327091043.30220-1-xiaoguangrong@tencent.com>
From: Xiao Guangrong <xiaoguangrong@tencent.com>
Now, we can reuse the path in ram_save_page() to post the page out
as normal, then the only thing remained in ram_save_compressed_page()
is compression that we can move it out to the caller
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
---
migration/ram.c | 45 ++++++++-------------------------------------
1 file changed, 8 insertions(+), 37 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index e71a9aee11..5187455a93 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1186,41 +1186,6 @@ static int compress_page_with_multi_thread(RAMState *rs, RAMBlock *block,
return pages;
}
-/**
- * ram_save_compressed_page: compress the given page and send it to the stream
- *
- * Returns the number of pages written.
- *
- * @rs: current RAM state
- * @block: block that contains the page we want to send
- * @offset: offset inside the block for the page
- * @last_stage: if we are at the completion stage
- */
-static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
- bool last_stage)
-{
- int pages = -1;
- uint8_t *p;
- RAMBlock *block = pss->block;
- ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
-
- p = block->host + offset;
-
- if (block != rs->last_sent_block) {
- /*
- * Make sure the first page is sent out before other pages.
- *
- * we post it as normal page as compression will take much
- * CPU resource.
- */
- pages = save_normal_page(rs, block, offset, p, true);
- } else {
- pages = compress_page_with_multi_thread(rs, block, offset);
- }
-
- return pages;
-}
-
/**
* find_dirty_block: find the next dirty page and update any state
* associated with the search process.
@@ -1520,8 +1485,14 @@ static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
return res;
}
- if (save_page_use_compression(rs)) {
- return ram_save_compressed_page(rs, pss, last_stage);
+ /*
+ * Make sure the first page is sent out before other pages.
+ *
+ * we post it as normal page as compression will take much
+ * CPU resource.
+ */
+ if (block == rs->last_sent_block && save_page_use_compression(rs)) {
+ res = compress_page_with_multi_thread(rs, block, offset);
}
return ram_save_page(rs, pss, last_stage);
--
2.14.3
prev parent reply other threads:[~2018-03-28 9:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 9:10 [Qemu-devel] [PATCH v2 00/10] migration: improve and cleanup compression guangrong.xiao
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 01/10] migration: stop compressing page in migration thread guangrong.xiao
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 02/10] migration: stop compression to allocate and free memory frequently guangrong.xiao
2018-03-28 9:25 ` Peter Xu
2018-03-29 3:41 ` Xiao Guangrong
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 03/10] migration: stop decompression " guangrong.xiao
2018-03-28 9:42 ` Peter Xu
2018-03-29 3:43 ` Xiao Guangrong
2018-03-29 4:14 ` Peter Xu
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 04/10] migration: detect compression and decompression errors guangrong.xiao
2018-03-28 9:59 ` Peter Xu
2018-03-29 3:51 ` Xiao Guangrong
2018-03-29 4:25 ` Peter Xu
2018-03-30 3:11 ` Xiao Guangrong
2018-04-02 4:26 ` Peter Xu
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 05/10] migration: introduce control_save_page() guangrong.xiao
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 06/10] migration: move some code ram_save_host_page guangrong.xiao
2018-03-28 10:05 ` Peter Xu
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 07/10] migration: move calling control_save_page to the common place guangrong.xiao
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 08/10] migration: move calling save_zero_page " guangrong.xiao
2018-03-27 9:10 ` [Qemu-devel] [PATCH v2 09/10] migration: introduce save_normal_page() guangrong.xiao
2018-03-27 9:10 ` guangrong.xiao [this message]
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=20180327091043.30220-11-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).