From patchwork Wed Mar 15 03:37:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 858585 jemmy X-Patchwork-Id: 9624757 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 47C336048C for ; Wed, 15 Mar 2017 03:38:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28F2828522 for ; Wed, 15 Mar 2017 03:38:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B6822856A; Wed, 15 Mar 2017 03:38:09 +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=-6.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SBL, T_DKIM_INVALID autolearn=ham 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 8107728522 for ; Wed, 15 Mar 2017 03:38:08 +0000 (UTC) Received: from localhost ([::1]:34541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnzlG-0007Hd-Nb for patchwork-qemu-devel@patchwork.kernel.org; Tue, 14 Mar 2017 23:38:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnzl4-0007Gi-S2 for qemu-devel@nongnu.org; Tue, 14 Mar 2017 23:37:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnzl1-0007Uj-Qw for qemu-devel@nongnu.org; Tue, 14 Mar 2017 23:37:54 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:33455) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnzl1-0007UT-L4; Tue, 14 Mar 2017 23:37:51 -0400 Received: by mail-pg0-x242.google.com with SMTP id y17so701571pgh.0; Tue, 14 Mar 2017 20:37:51 -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; bh=X9SHM1j9RdfLStja8jR/vOKARvnBC6uhsay+QHsd3Yg=; b=qjo2eRgvgVFtKugIYrG5Cw3lR7Duj+zL0dPYSeA5QU3jiTeeshMJCkQcl/viHmkR+a LwqKb4MHTbj8IpZ8xlvXF6S4yH2IKbUsbU8icZrxGDOK45xPtkpA81/L5wwURi4/ZLsE lXmKZMlMv+qlkOj+xxYTJbUqzfjkXhqRDz1lJQLFLWZ0ZMGXsg8p0q5htJ74JTN89MLO arbmo5MPHsVP0jZKnRlcmwj9RiS5c09UQz6g8jyRh+5ievoBtWDMWUlqsZfXm+d5Gkf2 cPOHxgftfl8WIi1HprfV46F+UwIxDvpZii16s0LrTxJT3TrAd2H/FKLBvdnaT4XMdKx7 Vilw== 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; bh=X9SHM1j9RdfLStja8jR/vOKARvnBC6uhsay+QHsd3Yg=; b=FCcbDt5rKKQpYxjlgmtKGV+9nMMnCujH5l+m60K80/Wd97hLmEO/sTysbSKXez5JDw 7MkezhlnXzCMEXdqdsfTWFSdbLEl81J6xDJy0ZXDNnhTARJ/2s0x3gybszNulOTuVUns x7mRh1lrG4BETr/P84dLHqiP+vY3YHEziy+iANcVJM7I2meTUahC/DHPEGuTLp/QwO0d vrHoV1HAaCisWLQalbjugI/AOfvDvhsPmsaUYfnB2xKrPMsP8l8i6VWP0FDApuWh8z37 MjSu/EDM93f2e2V/AD0o/BfMcA6itGXMRwirfSbtJmwRoogIFDZNUVsE6sspg0YrajKJ I+KQ== X-Gm-Message-State: AFeK/H2Yi6QRjPrAxSa0eY8KE1Bz0yfY3DTbqgStNzG/Ktwi7EuNXyQ1IYwpalAVXu26cg== X-Received: by 10.98.80.209 with SMTP id g78mr1190189pfj.163.1489549070495; Tue, 14 Mar 2017 20:37:50 -0700 (PDT) Received: from localhost.localdomain ([119.28.5.72]) by smtp.gmail.com with ESMTPSA id h20sm651163pfh.79.2017.03.14.20.37.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 20:37:50 -0700 (PDT) From: Lidong Chen To: qemu-devel@nongnu.org Date: Wed, 15 Mar 2017 11:37:33 +0800 Message-Id: <1489549053-31728-1-git-send-email-jemmy858585@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PATCH v2] migration/block: Avoid invoking blk_drain too frequently 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: famz@redhat.com, Lidong Chen , qemu-block@nongnu.org, quintela@redhat.com, dgilbert@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Increase bmds->cur_dirty after submit io, so reduce the frequency involve into blk_drain, and improve the performance obviously when block migration. The performance test result of this patch: During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s. Signed-off-by: Lidong Chen Reviewed-by: Kevin Wolf Reviewed-by: Fam Zheng --- migration/block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/block.c b/migration/block.c index 6741228..7734ff7 100644 --- a/migration/block.c +++ b/migration/block.c @@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, } bdrv_reset_dirty_bitmap(bmds->dirty_bitmap, sector, nr_sectors); + sector += nr_sectors; + bmds->cur_dirty = sector; + break; } sector += BDRV_SECTORS_PER_DIRTY_CHUNK;