From nobody Sun Apr 28 11:37:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1556435022; cv=none; d=zoho.com; s=zohoarc; b=BDptXecCzf2Oz4XWrOMR6qXlqcltB8L4NAXxwyPfId4AiIx5Gg7vDGcn+yGynwa1N+TvM1Nh3Xdnjc5IO9IC/K3SfnfxLkMZWK7e0tqEaMhvCpNcobFCdr2Zim6kPGPQtQWUDzMxi19b0ufzulKooSRojmQgkH7+dGqI0N5HwmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556435022; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=5rtTSNz21HOMREuwWS8OQj5nfpWO6/8akzgiMnARrLg=; b=d4/5MEYknBzpomcNKH+aBAmWDOQZSkJ+Q4ue2N/+nnG0bkOOxD9pIsKs8WtlvBvcUkR6GfuIg7EAmggAJUzdymGf7oRaYIGEzFf7YF2t+eu8Ld+ukLD7+5/prUDcNhnPDu6uN1uXvAP/qqS4IsLuB2l3+2MYCbuaTs1v7i5d04M= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1556435022575605.2595037752421; Sun, 28 Apr 2019 00:03:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C53581DE6; Sun, 28 Apr 2019 07:03:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A63524509; Sun, 28 Apr 2019 07:03:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 86EE241F3C; Sun, 28 Apr 2019 07:03:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3S73TOI023903 for ; Sun, 28 Apr 2019 03:03:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id D589317C48; Sun, 28 Apr 2019 07:03:29 +0000 (UTC) Received: from hansolo.nay.redhat.com (unknown [10.66.4.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id C48AF17AEA; Sun, 28 Apr 2019 07:03:26 +0000 (UTC) From: Han Han To: libvir-list@redhat.com Date: Sun, 28 Apr 2019 15:02:52 +0800 Message-Id: <20190428070252.9638-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Han Han Subject: [libvirt] [PATCH] qemu: Add entry for balloon stats stat-htlb-pgalloc and stat-htlb-pgfail X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 28 Apr 2019 07:03:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Qemu added reporting of virtio balloon new statistics stat-htlb-pgalloc and stat-htlb-pgfail since qemu-3.0 commit b7b12644297. The value of stat-htlb-pgalloc represents the number of successful hugetlb page allocati= ons while stat-htlb-pgfail represents the number of failed ones. Add this statistics reporting to libvirt. Signed-off-by: Han Han --- include/libvirt/libvirt-domain.h | 14 +++++++++++++- src/libvirt-domain.c | 5 ++++- src/qemu/qemu_driver.c | 2 ++ src/qemu/qemu_monitor_json.c | 5 +++++ tools/virsh-domain-monitor.c | 4 ++++ tools/virsh.pod | 2 ++ 6 files changed, 30 insertions(+), 2 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 7d36820b5a..192d25c1db 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -636,11 +636,23 @@ typedef enum { */ VIR_DOMAIN_MEMORY_STAT_DISK_CACHES =3D 10, =20 + /* + * The amount of successful hugetlb(Huge Page Tables) allocations via + * virtio balloon. + */ + VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC =3D 11, + + /* + * The amount of failed hugetlb(Huge Page Tables) allocations via + * virtio balloon. + */ + VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL =3D 12, + /* * The number of statistics supported by this version of the interface. * To add new statistics, add them to the enum and increase this value. */ - VIR_DOMAIN_MEMORY_STAT_NR =3D 11, + VIR_DOMAIN_MEMORY_STAT_NR =3D 13, =20 # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_MEMORY_STAT_LAST =3D VIR_DOMAIN_MEMORY_STAT_NR diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 80284a99f0..a95690e8a4 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -5734,7 +5734,10 @@ virDomainGetInterfaceParameters(virDomainPtr domain, * VIR_DOMAIN_MEMORY_STAT_DISK_CACHES * Memory that can be reclaimed without additional I/O, typically disk * caches (in kb). - * + * VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC + * The amount of successful hugetlb(Huge Page Tables) allocations + * VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL + * The amount of failed hugetlb(Huge Page Tables) allocations * Returns: The number of stats provided or -1 in case of failure. */ int diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f48d9256e4..2d849beac8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20245,6 +20245,8 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver, STORE_MEM_RECORD(LAST_UPDATE, "last-update") STORE_MEM_RECORD(USABLE, "usable") STORE_MEM_RECORD(DISK_CACHES, "disk_caches") + STORE_MEM_RECORD(HUGETLB_PGALLOC, "hugetlb_pgalloc") + STORE_MEM_RECORD(HUGETLB_PGFAIL, "hugetlb_pgfail") } =20 #undef STORE_MEM_RECORD diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 908967f46c..5e3df5e759 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2150,6 +2150,11 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 1); GET_BALLOON_STATS(statsdata, "stat-disk-caches", VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, 1024); + GET_BALLOON_STATS(statsdata, "stat-htlb-pgalloc", + VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC, 1); + GET_BALLOON_STATS(statsdata, "stat-htlb-pgfail", + VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL, 1); + ret =3D got; cleanup: virJSONValueFree(cmd); diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index d87475f6f6..0092a9786e 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -376,6 +376,10 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "last_update %llu\n", stats[i].val); if (stats[i].tag =3D=3D VIR_DOMAIN_MEMORY_STAT_DISK_CACHES) vshPrint(ctl, "disk_caches %llu\n", stats[i].val); + if (stats[i].tag =3D=3D VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC) + vshPrint(ctl, "hugetlb_pgalloc %llu\n", stats[i].val); + if (stats[i].tag =3D=3D VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL) + vshPrint(ctl, "hugetlb_pgfail %llu\n", stats[i].val); } =20 ret =3D true; diff --git a/tools/virsh.pod b/tools/virsh.pod index afc1684db0..ef27c527d6 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -938,6 +938,8 @@ without causing host swapping (in KiB) last-update - Timestamp of the last update of statistics (in secon= ds) disk_caches - The amount of memory that can be reclaimed without additional I/O, typically disk caches (in KiB) + hugetlb_pgalloc - The number of successful huge page table allocations + hugetlb_pgfail - The number of failed huge page table allocations =20 For QEMU/KVM with a memory balloon, setting the optional I<--period> to a value larger than 0 in seconds will allow the balloon driver to return --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list