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: 10446183 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 1806C60284 for ; Mon, 4 Jun 2018 09:56:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0874328BC6 for ; Mon, 4 Jun 2018 09:56:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F159228BD0; Mon, 4 Jun 2018 09:56:40 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E9AB28BC6 for ; Mon, 4 Jun 2018 09:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752525AbeFDJ4i (ORCPT ); Mon, 4 Jun 2018 05:56:38 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:44967 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752520AbeFDJ43 (ORCPT ); Mon, 4 Jun 2018 05:56:29 -0400 Received: by mail-pf0-f195.google.com with SMTP id h12-v6so5789817pfk.11 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=gJL25C3c/MnT7bPbLQmH7PppOClocgGBolhT/92nwhFjXLSRs7bs8WK8DzpARwoFSz SvXlyC5lcAp3zqLsfBTRxOksrNsFA2CSX38IrgrIzzrdHmMtO2AKN3gNc61IZewirC5C tYPbSJNlqPnQWK63oHp+9M8lvPiF830fZXyNvkhJE9GYrP5m5UuJQP48NDGNLUTimHne GaYXoziSPuxg7gW/PmplARaQRKBbMKM4gHRAtQZchc3mCJgws9F5Ggd8m0qp8t9oLxo0 ccPa762TQNiF7ofQ8qPwFWhhXLVwwDsqCFXVFs3687mSZhSkjYVJ8J+U7GDpyPnh/CTg ZDYg== X-Gm-Message-State: ALKqPwfztQyRjSfs3BXOUThbGhLYvbu+wCiznMCEvqkv069Biy+9Tk++ mBOJrBJeAk4Xp8vqZecJ/No= 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 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 Subject: [PATCH 08/12] migration: do not flush_compressed_data at the end of each iteration 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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(); /*