From nobody Mon Feb 9 21:24:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626430752671783.9208084965545; Fri, 16 Jul 2021 03:19:12 -0700 (PDT) Received: from localhost ([::1]:56610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4Kw3-00078m-Nb for importer@patchew.org; Fri, 16 Jul 2021 06:19:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4KtZ-00030F-O6 for qemu-devel@nongnu.org; Fri, 16 Jul 2021 06:16:39 -0400 Received: from prt-mail.chinatelecom.cn ([42.123.76.227]:55465 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4KtX-0001ZW-Dr for qemu-devel@nongnu.org; Fri, 16 Jul 2021 06:16:37 -0400 Received: from clientip-202.80.192.38?logid-18396dd2c1a74a5e983265ee02004bbb (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 79B6428008F; Fri, 16 Jul 2021 18:16:30 +0800 (CST) Received: from ([172.18.0.218]) by app0025 with ESMTP id 37daaae73a6944818c997b0bd2b9df32 for qemu-devel@nongnu.org; Fri Jul 16 18:16:31 2021 HMM_SOURCE_IP: 172.18.0.218:50248.2135642226 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn X-Transaction-ID: 37daaae73a6944818c997b0bd2b9df32 X-filter-score: X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: qemu-devel@nongnu.org Subject: [PATCH v4 1/2] memory: introduce total_dirty_pages to stat dirty pages Date: Fri, 16 Jul 2021 18:20:49 +0800 Message-Id: <4b859c39e6a7debdef530078d4dca8e1582a918e.1626430691.git.huangy81@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=42.123.76.227; 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Juan Quintela , Hyman , "Dr. David Alan Gilbert" , Peter Xu , Chuan Zheng , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1626430753938100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) introduce global var total_dirty_pages to stat dirty pages along with memory_global_dirty_log_sync. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- include/exec/ram_addr.h | 4 ++++ migration/dirtyrate.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 45c9132..e98d665 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -26,6 +26,8 @@ #include "exec/ramlist.h" #include "exec/ramblock.h" =20 +extern uint64_t total_dirty_pages; + /** * clear_bmap_size: calculate clear bitmap size * @@ -366,6 +368,7 @@ static inline void cpu_physical_memory_set_dirty_lebitm= ap(unsigned long *bitmap, for (k =3D 0; k < nr; k++) { if (bitmap[k]) { unsigned long temp =3D leul_to_cpu(bitmap[k]); + total_dirty_pages +=3D ctpopl(temp); =20 qatomic_or(&blocks[DIRTY_MEMORY_VGA][idx][offset], tem= p); =20 @@ -403,6 +406,7 @@ static inline void cpu_physical_memory_set_dirty_lebitm= ap(unsigned long *bitmap, for (i =3D 0; i < len; i++) { if (bitmap[i] !=3D 0) { c =3D leul_to_cpu(bitmap[i]); + total_dirty_pages +=3D ctpopl(c); do { j =3D ctzl(c); c &=3D ~(1ul << j); diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index f92c4b4..17b3d2c 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -28,6 +28,13 @@ #include "sysemu/runstate.h" #include "exec/memory.h" =20 +/* + * total_dirty_pages is procted by BQL and is used + * to stat dirty pages during the period of two + * memory_global_dirty_log_sync + */ +uint64_t total_dirty_pages; + typedef struct DirtyPageRecord { uint64_t start_pages; uint64_t end_pages; --=20 1.8.3.1