From nobody Sat Nov 15 20:51:04 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1747227193; cv=none; d=zohomail.com; s=zohoarc; b=AWNnLUtTDFKR9Bf4VKaMD06z/nGIwixhLVTCYPvMXsBsxGqLF/I1pHbXs5snzlGUo2Nw/Lt0uEBLXqNalhEfoceYS6MJp25LruLwQNorRNFY+tSFMSjTZtn+vUibmHty7P+61k3uipRnmXVcesLnmJSePSNuPl6kGWPZAFIMUHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747227193; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Xsw48AKk8CYEWDlWDcJoP4kYuHx7KlGPMhpRO9e6nME=; b=gM5koAF9CDFOt9fd2CzzrC0n3D4cl93/m/kFIVjutHNwfW05KoZay6cpSdpoESOvHrpJjiIhhJMttspNsDwmoAtepAXgXLUt+LnQ13/o63Fq12bn6Y9HIuBXqzL5SReR4ozVTBx8gU0q3bKPB9FSDYJsNqF83jhTIMUQ38oxxaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747227193570124.93009941269202; Wed, 14 May 2025 05:53:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uFBbT-0002r5-45; Wed, 14 May 2025 08:52:55 -0400 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 1uFAm7-0000Mg-MS for qemu-devel@nongnu.org; Wed, 14 May 2025 07:59:52 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uFAm2-0000JL-TL for qemu-devel@nongnu.org; Wed, 14 May 2025 07:59:51 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7410c18bb00so8057745b3a.3 for ; Wed, 14 May 2025 04:59:45 -0700 (PDT) Received: from n37-071-053.byted.org ([115.190.40.15]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74237a0cfc5sm9699366b3a.91.2025.05.14.04.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 May 2025 04:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1747223984; x=1747828784; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Xsw48AKk8CYEWDlWDcJoP4kYuHx7KlGPMhpRO9e6nME=; b=URS1Ay2KV9VQ6ojyOlBvozi+F4p8O6gcs5xbzEfQaLh4MiwIsxVHf/5W7M9lp7MJ6K HJtWTxkojsqVNJYTfyeZA9sFkfhl3tnpQ1R3s4gWawxGq3f23pLQHVQVU83gv5XTlDEL JQEFGuX6/6TwJTZoEWzXPEPvy7uHo53LbSlHDe8y+PWjdAD8AeqZwyjPlXbo5jUBITNn 6DJng5RrgLpif9+iDoq3qtL28jIf3y5QHDkUeTRz0dOUfFXs38JtmDGn1Dn/kMyhXSe9 LcwtnfZKerVt72mh6nw0YHOEh+TvJD9z7QaQhoaU+9zDyGm7r3StBxySYC08w53ZwbnV s77A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747223984; x=1747828784; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xsw48AKk8CYEWDlWDcJoP4kYuHx7KlGPMhpRO9e6nME=; b=n4b4FU6hM5sCFOwmZ3KRXMP9MqN2KTFTCz6ZVBBZyvoxAwCe80MlAjSiWMKGV4vSJR 0d5VzNTzyOuG0WKdLQ0NzZlf0sPI+24YszxuNaKDaqAppfkwu4wIxiU8p6a17viDGDIH m7ekA/x30j/HR6rmAzABdVp9B+V9FR5W2YbymhlXmGASDgqhFbwh6G8kTQdrmv2SSTSD 2OeI8sjj5IVfgrxyTY9C3sTiB/lYku0r/QJyK8S/2eek44MpjKLkK/D9aUlhu0iJl5IE e/Oobb1UrP/WPT9rYlAzrTWN8vXRcTr33WV9Skj4TGqqlkOQI2joUC9V1af2zlz8d2L3 K1nQ== X-Gm-Message-State: AOJu0YxvtxiHgGOK8ciK+pAP17hyhG2VMyHIj9DiOz6Xmc0Nh/Ot9wSg eg0zMlS68fNx6ejssWbYFSL9qkcoECtGT/n7Qu/NgowIeFkbEl4lr02lcvGDaHA= X-Gm-Gg: ASbGnctZf2MmXIopUoHuLVjzcWBMW0R55Zyixi9aPIwFZJzHzhze1dY6BFoA8pU/MAt ajlVv6yWo7wyGwY8sP087KdyOhiB7zAD9yorBVVkmmSiQnC2St2PZCl8diPrKSy8RBZsg1zazKZ q7XOIGzjeS8EJnFMygRQSs0njV1GVJ5td5GnElPLCRjHDwd7odCbNlQWEswuVbn8Y8RwPplhnLN 3d6Am/20v41sNpE70Vq1guSw5xpSlfwWAEue2VtvnfGU1rN13ln5Y4vBqvpt4BCgn/WXbLSrBHr sPx+6NDeOslVwfJGd26T/8L+hChLVlzgbdya74Tljujgy9RYaBIR9ocsGTuEMEntlSGaHw== X-Google-Smtp-Source: AGHT+IE+tGbSxo25JTfQgRJG0YRuAZnH99p+Vda0DChGHrFzAKzgKRsT1PHPK0TekB3KyYJf9bR2eA== X-Received: by 2002:a05:6a20:914e:b0:1f5:709d:e0c6 with SMTP id adf61e73a8af0-215ff1b725amr4466320637.42.1747223984316; Wed, 14 May 2025 04:59:44 -0700 (PDT) From: Yanfei Xu To: peterx@redhat.com, farosas@suse.de Cc: qemu-devel@nongnu.org, Yanfei Xu Subject: [RFC PATCH] migration/ram: avoid to do log clear in the last round Date: Wed, 14 May 2025 19:58:27 +0800 Message-Id: <20250514115827.3216082-1-yanfei.xu@bytedance.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=yanfei.xu@bytedance.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 14 May 2025 08:52:48 -0400 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @bytedance.com) X-ZM-MESSAGEID: 1747227194625116600 Content-Type: text/plain; charset="utf-8" There won't be any ram sync after the stage of save_complete, therefore it's unnecessary to do manually protect for dirty pages being sent. Skip to do this in last round can reduce noticeable downtime. Signed-off-by: Yanfei Xu Reviewed-by: Fabiano Rosas Tested-by: Fabiano Rosas --- As I don't have proper machine to test this patch in qemu and verify if it = has risks like in postcopy, colo and so on.(But I tested this idea on my rust V= MM, it works and can reduce ~50ms for a 128GB guest). So I raise the patch with= RFC for suggestions. migration/ram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index e12913b43e..2b169cdd18 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -838,7 +838,9 @@ static inline bool migration_bitmap_clear_dirty(RAMStat= e *rs, * the page in the chunk we clear the remote dirty bitmap for all. * Clearing it earlier won't be a problem, but too late will. */ - migration_clear_memory_region_dirty_bitmap(rb, page); + if (!rs->last_stage) { + migration_clear_memory_region_dirty_bitmap(rb, page); + } =20 ret =3D test_and_clear_bit(page, rb->bmap); if (ret) { --=20 2.20.1