From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL5gs-0007N7-5B for qemu-devel@nongnu.org; Mon, 18 Jan 2016 04:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL5gk-0006qy-KD for qemu-devel@nongnu.org; Mon, 18 Jan 2016 04:01:34 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:5521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL5gj-0006ns-FV for qemu-devel@nongnu.org; Mon, 18 Jan 2016 04:01:26 -0500 References: <1452851297-11198-1-git-send-email-liang.z.li@intel.com> <5698C735.3020409@huawei.com> From: Hailiang Zhang Message-ID: <569CA9CC.80603@huawei.com> Date: Mon, 18 Jan 2016 17:01:00 +0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] migration: not send zero page header in ram bulk stage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Li, Liang Z" , "qemu-devel@nongnu.org" Cc: "amit.shah@redhat.com" , "pbonzini@redhat.com" , "quintela@redhat.com" , peter.huangpeng@huawei.com, "dgilbert@redhat.com" Hi, On 2016/1/15 18:24, Li, Liang Z wrote: >> It seems that this patch is incorrect, if the no-zero pages are zeroed again >> during !ram_bulk_stage, we didn't send the new zeroed page, there will be >> an error. >> > > If not in ram_bulk_stage, still send the header, could you explain why it's wrong? > > Liang > I have made a mistake, and yes, this patch can speed up the live migration time, especially when there are many zero pages, it will be more obvious. I like this idea. Did you test it with postcopy ? Does it break postcopy ? Thanks, zhanghailiang >>> For guest just uses a small portions of RAM, this change can avoid >>> allocating all the guest's RAM pages in the destination node after >>> live migration. Another benefit is destination QEMU can save lots of >>> CPU cycles for zero page checking. >>> >>> Signed-off-by: Liang Li >>> --- >>> migration/ram.c | 10 ++++++---- >>> 1 file changed, 6 insertions(+), 4 deletions(-) >>> >>> diff --git a/migration/ram.c b/migration/ram.c index 4e606ab..c4821d1 >>> 100644 >>> --- a/migration/ram.c >>> +++ b/migration/ram.c >>> @@ -705,10 +705,12 @@ static int save_zero_page(QEMUFile *f, >> RAMBlock >>> *block, ram_addr_t offset, >>> >>> if (is_zero_range(p, TARGET_PAGE_SIZE)) { >>> acct_info.dup_pages++; >>> - *bytes_transferred += save_page_header(f, block, >>> - offset | RAM_SAVE_FLAG_COMPRESS); >>> - qemu_put_byte(f, 0); >>> - *bytes_transferred += 1; >>> + if (!ram_bulk_stage) { >>> + *bytes_transferred += save_page_header(f, block, offset | >>> + RAM_SAVE_FLAG_COMPRESS); >>> + qemu_put_byte(f, 0); >>> + *bytes_transferred += 1; >>> + } >>> pages = 1; >>> } >>> >>> >> >> > > > . >