From patchwork Sat Dec 3 16:38:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hyman Huang X-Patchwork-Id: 13063581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19041C352A1 for ; Sat, 3 Dec 2022 16:41:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1VY4-0001y3-AY; Sat, 03 Dec 2022 11:39:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1VXv-0001u1-Q7 for qemu-devel@nongnu.org; Sat, 03 Dec 2022 11:39:24 -0500 Received: from prt-mail.chinatelecom.cn ([42.123.76.223] helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1VXt-0004mW-5r for qemu-devel@nongnu.org; Sat, 03 Dec 2022 11:39:22 -0500 HMM_SOURCE_IP: 172.18.0.218:35940.967913464 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-125.69.43.82 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 743952800B8; Sun, 4 Dec 2022 00:39:18 +0800 (CST) X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn Received: from ([125.69.43.82]) by app0025 with ESMTP id cfe31c6793af4709aa048bb34dca61e6 for qemu-devel@nongnu.org; Sun, 04 Dec 2022 00:39:20 CST X-Transaction-ID: cfe31c6793af4709aa048bb34dca61e6 X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 125.69.43.82 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: qemu-devel Cc: Peter Xu , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini , Laurent Vivier , Eric Blake , Juan Quintela , Thomas Huth , Peter Maydell , Richard Henderson , =?utf-8?b?SHltYW4gSHVh?= =?utf-8?b?bmco6buE5YuHKQ==?= Subject: [PATCH v3 07/10] migration: Refactor auto-converge capability logic Date: Sun, 4 Dec 2022 00:38:52 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=42.123.76.223; envelope-from=huangy81@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Hyman Huang(黄勇) Check if block migration is running before throttling guest down in auto-converge way. Note that this modification is kind of like code clean, because block migration does not depend on auto-converge capability, so the order of checks can be adjusted. Signed-off-by: Hyman Huang(黄勇) --- migration/ram.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 1338e47..5e66652 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1151,7 +1151,11 @@ static void migration_trigger_throttle(RAMState *rs) /* During block migration the auto-converge logic incorrectly detects * that ram migration makes no progress. Avoid this by disabling the * throttling logic during the bulk phase of block migration. */ - if (migrate_auto_converge() && !blk_mig_bulk_active()) { + if (blk_mig_bulk_active()) { + return; + } + + if (migrate_auto_converge()) { /* The following detection logic can be refined later. For now: Check to see if the ratio between dirtied bytes and the approx. amount of bytes that just got transferred since the last time