From patchwork Thu Dec 13 07:57:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 1012671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Vajf1Dkz"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43FmJc35fpz9s4s for ; Thu, 13 Dec 2018 18:58:23 +1100 (AEDT) Received: from localhost ([::1]:51040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXLsy-0003k3-6H for incoming@patchwork.ozlabs.org; Thu, 13 Dec 2018 02:58:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXLsQ-0003jo-TN for qemu-devel@nongnu.org; Thu, 13 Dec 2018 02:57:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXLsO-0001pQ-3Y for qemu-devel@nongnu.org; Thu, 13 Dec 2018 02:57:46 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:41381) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXLsL-0001jt-TB for qemu-devel@nongnu.org; Thu, 13 Dec 2018 02:57:43 -0500 Received: by mail-pl1-x644.google.com with SMTP id u6so664497plm.8 for ; Wed, 12 Dec 2018 23:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+usJZdMS1lA1aoaksKsSdXTm5hdboDDv7Gdwa+B6S8M=; b=Vajf1Dkz/e3L4fLGQiuD9SMh84oxIC0SLB7adq3nn6zw8OensQmrnINDMjXxrHPd5d ei8PnpkjOWmJee8teKGTMF7m2xtNZquJnyhLuh7p7iUZXMr5/gqLr0dAkXAheU2ETqp+ PkeK3Qpd+mNXQf5lCvpZkti5qKaUG4w+1L7uoMwNTyJ/QDwdauRPy53tGDZtvbpe17BQ TPmmn5Zz9NhRs3hbMd7kU1W7OYBMMUOCKODlAJmCS05mas5sKjrgClXQ7C6Fq/cW9kPn wZ0Yyo3dwI2NwaFXwJx3bAHdIT/6fLTfpQlpwaj75sOOkRUDTJlydigGx0WYJ1r1aorL I6Zg== 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=+usJZdMS1lA1aoaksKsSdXTm5hdboDDv7Gdwa+B6S8M=; b=VoIy+5Cpm2JCT97bXVAxng0x9eutQPXhFusDRbUaQlfHSiZnfkHfxzK19w2MD7I2iP BbNVpco5BRtZfH98W5kz7l5W2TmfNoN8FQqoDKuBYLTsXl9+SnQ/ziSOipq+UGDoLtot CeFg+9HvFIC5wAHasu2LMcnWwaXXwCDHhwwcbME/jeGNGC03xr2Scpwk+XEAHC1ZOoXF 6R4q3cUr2eqGS6mllMvT62vmuIj2JZ7+Ia11ojUer71kql8I7VXkzd5karNW7ofIAHQE mMlmUVscIfI7Icp7Z41hbCLCRIr3ewvZQF6dOUoXb77q2SfbkVLoHgYwan9ys+57vDP4 NuJQ== X-Gm-Message-State: AA+aEWbn19oIMyIg9KXifle8c1Wap7M4g3vLa84bTqHlKkI56BRIyMG7 pnMUDmuAYlww4IClllRtmTs= X-Google-Smtp-Source: AFSGD/UWwTYT5YH5RrqdoiUQBR0HAlm47MkysueDyJT/KCWpsr5hC43SyZH+yaOXFH+D1pCj+TS7MA== X-Received: by 2002:a17:902:8d95:: with SMTP id v21mr22705002plo.162.1544687857754; Wed, 12 Dec 2018 23:57:37 -0800 (PST) Received: from localhost.localdomain ([203.205.141.36]) by smtp.gmail.com with ESMTPSA id h19sm1423618pfn.114.2018.12.12.23.57.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 23:57:37 -0800 (PST) From: guangrong.xiao@gmail.com X-Google-Original-From: xiaoguangrong@tencent.com To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com Date: Thu, 13 Dec 2018 15:57:25 +0800 Message-Id: <20181213075727.23540-1-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.14.5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH 0/2] optimize waiting for free thread to do compression 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, quintela@redhat.com, Xiao Guangrong , qemu-devel@nongnu.org, peterx@redhat.com, dgilbert@redhat.com, wei.w.wang@intel.com, cota@braap.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Xiao Guangrong Currently we have two behaviors if all threads are busy to do compression, the main thread mush wait one of them becoming free if @compress-wait-thread set to on or the main thread can directly return without wait and post the page out as normal one Both of them have its profits and short-comes, however, if the bandwidth is not limited extremely so that compression can not use out all of it bandwidth, at the same time, the migration process is easily throttled if we posted too may pages as normal pages. None of them can work properly under this case In order to use the bandwidth more effectively, we introduce the third behavior, compress-wait-thread-adaptive, which make the main thread wait if there is no bandwidth left or let the page go out as normal page if there has enough bandwidth to make sure the migration process will not be throttled Another patch introduces a new statistic, pages-per-second, as bandwidth or mbps is not enough to measure the performance of posting pages out as we have compression, xbzrle, which can significantly reduce the amount of the data size, instead, pages-per-second if the one we want Performance data ================ We have limited the bandwidth to 300 Used Bandwidth Pages-per-Second compress-wait-thread = on 951.66 mbps 131784 compress-wait-thread = off 2491.74 mbps 93495 compress-wait-thread-adaptive 1982.94 mbps 162529 = on Xiao Guangrong (2): migration: introduce compress-wait-thread-adaptive migration: introduce pages-per-second hmp.c | 13 ++++++ migration/migration.c | 49 +++++++++++++++++++- migration/migration.h | 12 +++++ migration/ram.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++---- qapi/migration.json | 31 +++++++++++-- 5 files changed, 215 insertions(+), 14 deletions(-)