From patchwork Mon Jun 4 09:55:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 10446263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62E1F60284 for ; Mon, 4 Jun 2018 10:06:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53DF428B9A for ; Mon, 4 Jun 2018 10:06:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48D1528BD0; Mon, 4 Jun 2018 10:06:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F53428B9A for ; Mon, 4 Jun 2018 10:06:12 +0000 (UTC) Received: from localhost ([::1]:38666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPmNP-0007d4-AQ for patchwork-qemu-devel@patchwork.kernel.org; Mon, 04 Jun 2018 06:06:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPmE7-0007mP-05 for qemu-devel@nongnu.org; Mon, 04 Jun 2018 05:56:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPmE2-0001GU-4w for qemu-devel@nongnu.org; Mon, 04 Jun 2018 05:56:35 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:42185) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPmE1-0001GA-VB for qemu-devel@nongnu.org; Mon, 04 Jun 2018 05:56:30 -0400 Received: by mail-pf0-x243.google.com with SMTP id w7-v6so272827pfn.9 for ; Mon, 04 Jun 2018 02:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6UIMXJeRHsmt3t6Z9BLFXL0bs+zbtKQsppSSK4fEsCs=; b=s7kAjAmikinq0AESH3ls5h4ISiHqsxfDeaTMCgi82IhvA+kOXq1XpqALjnuEAwYRha 5f0QixuXqoAQJ8yB7EBBV7HHE4FAWXLmT2/ppOIkJw7T9TkyDQLPdZ9KVc7Ax1QEr3b0 WI6gHC2n7K/ZRzCdh8mzN56qrMljHIhe2YdyVJ08VTNx1CaWmMKfj3TI11HsaKl5Z9CB Ihh1Tq3ZG8lp18JWZ4doV+SnvDuIX02mvG2dJuQ0MR6qfjQ50+8KqqVrceZypam2RdRc NIq/uw9ffM39ON1wUtxWAQRPXFdCLtTMN1NGH27Rlq+RXb4wzWY0oly7YyngJN6QebRV JRsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6UIMXJeRHsmt3t6Z9BLFXL0bs+zbtKQsppSSK4fEsCs=; b=hKmFfLJmp/lK3NQDSzPUqxaXzEyRRUWf6qfhkbASs9zUN3MSvO5CKRIsGkm8qhdZk7 Moal3DRVQeqvxgL+RKPM/SN7XMihlJxZDH8MEijLp2a+vPZJdoXnJPc28mbIc5tPYGTe u2YJ7vokik4vMkLrt816ePAB7fgUnHNQMG++gQMa/qPpwwsNkL5bCKfmY1PGmlndmK0G FX1WzlET4bGH0JQmDJ3bFsot7cP2J4hgUYW4POmIYptC0HfOn2N/MG+POC+3mo47jlwm SviswOX8x9nEs9F0D49po0qOzVtiqSpOPC9drDLlShtEOMZRwA7mCwDxxetBv/gMbUVd LozA== X-Gm-Message-State: ALKqPwdZBLkvG/FfjwU9FJ4YncxMiT+D9JniiNCRmh6bz11um+P6bGVx a0/mtes1tn5ZyEH8BCyO9uU= X-Google-Smtp-Source: ADUXVKKqubf/LkGirzMmh8PqssJ2bkS4ch5nn7rZmf/Y9/toxisMiT1yAoaYEtnhlxLi/lHuI0jMPw== X-Received: by 2002:a62:ff1d:: with SMTP id b29-v6mr20815419pfn.181.1528106188946; Mon, 04 Jun 2018 02:56:28 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.35]) by smtp.gmail.com with ESMTPSA id h130-v6sm124502105pfc.98.2018.06.04.02.56.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jun 2018 02:56:28 -0700 (PDT) From: guangrong.xiao@gmail.com X-Google-Original-From: xiaoguangrong@tencent.com To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com Date: Mon, 4 Jun 2018 17:55:16 +0800 Message-Id: <20180604095520.8563-9-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180604095520.8563-1-xiaoguangrong@tencent.com> References: <20180604095520.8563-1-xiaoguangrong@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH 08/12] migration: do not flush_compressed_data at the end of each iteration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Xiao Guangrong , qemu-devel@nongnu.org, peterx@redhat.com, dgilbert@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xiao Guangrong flush_compressed_data() needs to wait all compression threads to finish their work, after that all threads are free until the migration feed new request to them, reducing its call can improve the throughput and use CPU resource more effectively We do not need to flush all threads at the end of iteration, the data can be kept locally until the memory block is changed Signed-off-by: Xiao Guangrong --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index f9a8646520..0a38c1c61e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1994,6 +1994,7 @@ static void ram_save_cleanup(void *opaque) } xbzrle_cleanup(); + flush_compressed_data(*rsp); compress_threads_save_cleanup(); ram_state_cleanup(rsp); } @@ -2690,7 +2691,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) } i++; } - flush_compressed_data(rs); rcu_read_unlock(); /*