From nobody Tue Feb 10 06:07:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204029; cv=none; d=zohomail.com; s=zohoarc; b=gMJX8Y2UfcJ02y1ydFBpqIjJEiMqiANoXC2SwiBMAEwuGK+Yaz+ATfmMZFOzEMk3rkDTMGkY91PzF8iQqPa7ByyYB1MEpw6VA0KEsTkqE2bNh9m6bvkP9oMrzsaod7L2zokEfkA+JltlolCYxJx19o1jnmbK58azHTF5FXo+Ieo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204029; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T6NDPnkzHlHMJ2E96BT2L8DNXWr8MPzQrE/ZuIz1ThM=; b=TZxxuTWmRqSYDocCIDFtLIolNtGTH4hoPdoeJQCJMPqDpQAo2mqBLNfMfAYcrqRZDG2PCP5znFYxI17v2FmOn1mdwrkS3f9ptvaIB0RiefCYes13x9aKklR3B05DUTVTjQPN9eqCrxXLu7BD8KnzK/+z9/epqAbn/onK6703FJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1690204029429396.2858052424974; Mon, 24 Jul 2023 06:07:09 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-c3-pxxrqPImjGYNSLSo0tA-1; Mon, 24 Jul 2023 09:07:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD22510504AB; Mon, 24 Jul 2023 13:07:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C62C0F782E; Mon, 24 Jul 2023 13:07:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A3570194658D; Mon, 24 Jul 2023 13:07:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 060601946594 for ; Mon, 24 Jul 2023 13:07:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D67ADF783C; Mon, 24 Jul 2023 13:07:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08C65F782E; Mon, 24 Jul 2023 13:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204028; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=T6NDPnkzHlHMJ2E96BT2L8DNXWr8MPzQrE/ZuIz1ThM=; b=YCqlaF6ykjb25vZyGK5W+eOjSMj/1T/Oq14jyMiQBRU5UB9/yVBI3B98z1Wlg4m/KTsFcW FPlMV7u/4BOeyVUt6Ku1iA30DKVjMQ/Sw+X3ui/oVvuUuU9B7yhMFe52f/zP/yNXDcteym ud33yfZic9ZNLu5Jdq/ixF4k0WQkHhY= X-MC-Unique: c3-pxxrqPImjGYNSLSo0tA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 08/26] migration: Put the detection logic before auto-converge checking Date: Mon, 24 Jul 2023 15:06:21 +0200 Message-Id: <20230724130639.93135-9-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= , Thomas Huth , Juan Quintela , libvir-list@redhat.com, Markus Armbruster , Peter Xu , Leonardo Bras , Paolo Bonzini , Eric Blake Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204150712100003 From: Hyman Huang(=E9=BB=84=E5=8B=87) This commit is prepared for the implementation of dirty-limit convergence algo. The detection logic of throttling condition can apply to both auto-converge and dirty-limit algo, putting it's position before the checking logic for auto-converge feature. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Juan Quintela Message-ID: <168733225273.5845.15871826788879741674-6@git.sr.ht> Signed-off-by: Juan Quintela --- migration/ram.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index f31de47a47..1d9300f4c5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -999,17 +999,18 @@ static void migration_trigger_throttle(RAMState *rs) return; } =20 - 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 - we were in this routine reaches the threshold. If that happens - twice, start or increase throttling. */ - - if ((bytes_dirty_period > bytes_dirty_threshold) && - (++rs->dirty_rate_high_cnt >=3D 2)) { + /* + * 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 + * we were in this routine reaches the threshold. If that happens + * twice, start or increase throttling. + */ + if ((bytes_dirty_period > bytes_dirty_threshold) && + (++rs->dirty_rate_high_cnt >=3D 2)) { + rs->dirty_rate_high_cnt =3D 0; + if (migrate_auto_converge()) { trace_migration_throttle(); - rs->dirty_rate_high_cnt =3D 0; mig_throttle_guest_down(bytes_dirty_period, bytes_dirty_threshold); } --=20 2.40.1