From nobody Fri May 10 08:09:22 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530530401228430.40621909004255; Mon, 2 Jul 2018 04:20:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 953A3308213E; Mon, 2 Jul 2018 11:19:59 +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 5E2155DD82; Mon, 2 Jul 2018 11:19:59 +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 10F733FCC1; Mon, 2 Jul 2018 11:19:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w62BJoo0015833 for ; Mon, 2 Jul 2018 07:19:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 610704B6; Mon, 2 Jul 2018 11:19:50 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 540D85C54C for ; Mon, 2 Jul 2018 11:19:47 +0000 (UTC) Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B37130832CF for ; Mon, 2 Jul 2018 11:19:47 +0000 (UTC) Received: by mail-wr0-f198.google.com with SMTP id u1-v6so5622810wrs.18 for ; Mon, 02 Jul 2018 04:19:47 -0700 (PDT) Received: from fiorina.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 17-v6sm4289797wmg.5.2018.07.02.04.19.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 04:19:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cKVT2K9OPyDTKXX4d0Aykc1e0gvNrcxbIvcAWsR0VOk=; b=h0lCLknmpjKNUH4YBQZ7gdN/1n4hlCJtX4r9TH0TiCx6uTOuZhpy2kfr4YwsXmQI/O iFcfuweyhAZYH8LEZExX/HlPlMgdXiQBJRF07RQ7s4IdWC7AviXJUfqtP0quoJnnhbul m0WQ2wQyp2gEqXBT2NXhuAw0v0y/qgptKG6uw1FrR2LH0u8vzz8+QzS71FvX3bnq67H6 TW7vnjnTATC4OZ/0fB865yBDn6vYXDatN5Lx2zJaCq4EhjBLwcc0O6t2ps2aejhECoPI vLY9vBnhwr2LxWP5AXOz88ygZkOCCYgg15jju0mgFINgmxDWg5cn1NFEwKbb81XielYN XagQ== X-Gm-Message-State: APt69E0p3m2YjpE91cKwbYBFEKRkFXOj/3z5mr5Z3SQNqCndWfgzh6CA e6+NhvQjpDVOR6uETRV/3DOIU6F+T1zx8SPOGJ+nPy31CE8Kw9yXxQ6GnXLaImn7d56r4Q1UoRS 0ucLc24x82nSQPlyGFJE8 X-Received: by 2002:a1c:5b0d:: with SMTP id p13-v6mr8009615wmb.53.1530530385714; Mon, 02 Jul 2018 04:19:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe6mWByg1sv58nCpquUxRXIpAydKwJXQI9Pxze4bwZ8xt6B5Fhb5qEBUKRNOGeeyzKegf5HoA== X-Received: by 2002:a1c:5b0d:: with SMTP id p13-v6mr8009608wmb.53.1530530385548; Mon, 02 Jul 2018 04:19:45 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: libvirt-list@redhat.com Date: Mon, 2 Jul 2018 13:19:42 +0200 Message-Id: <85cb098b9c5d1757516c49ee24209c6456547eaa.1530530364.git.tgolembi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= Subject: [libvirt] [PATCH v3 1/1] qemu: Add entry for balloon stat stat-disk-caches 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 02 Jul 2018 11:20:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 QEMU commit bf1e7140e adds reporting of new balloon statistic to QEMU 2.12. Value represents the amount of memory that can be quickly reclaimed without additional I/O. Let's add that too. Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD Reviewed-by: John Ferlan --- include/libvirt/libvirt-domain.h | 9 ++++++++- src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/qemu/qemu_monitor_json.c | 2 ++ tools/virsh-domain-monitor.c | 2 ++ tools/virsh.pod | 5 +++++ 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 796f2e1408..fdd2d6b8ea 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -628,11 +628,18 @@ typedef enum { /* Timestamp of the last update of statistics, in seconds. */ VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE =3D 9, =20 + /* + * The amount of memory, that can be quickly reclaimed without + * additional I/O (in kB). Typically these pages are used for caching = files + * from disk. + */ + VIR_DOMAIN_MEMORY_STAT_DISK_CACHES =3D 10, + /* * 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 10, + VIR_DOMAIN_MEMORY_STAT_NR =3D 11, =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 c71f2e6877..ef39361c95 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -5732,6 +5732,9 @@ virDomainGetInterfaceParameters(virDomainPtr domain, * Current balloon value (in kb). * VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE * Timestamp of the last statistic + * VIR_DOMAIN_MEMORY_STAT_DISK_CACHES + * Memory that can be reclaimed without additional I/O, typically disk + * caches (in kb). * * Returns: The number of stats provided or -1 in case of failure. */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 825b2b27e6..f88fb44373 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19795,6 +19795,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver, STORE_MEM_RECORD(RSS, "rss") STORE_MEM_RECORD(LAST_UPDATE, "last-update") STORE_MEM_RECORD(USABLE, "usable") + STORE_MEM_RECORD(DISK_CACHES, "disk_caches") } =20 #undef STORE_MEM_RECORD diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3e90279b71..9d161fe6f4 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2071,6 +2071,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, VIR_DOMAIN_MEMORY_STAT_USABLE, 1024); GET_BALLOON_STATS(data, "last-update", VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 1); + GET_BALLOON_STATS(statsdata, "stat-disk-caches", + VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, 1024); ret =3D got; cleanup: virJSONValueFree(cmd); diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 87660ee674..b9b4f9739b 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -364,6 +364,8 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "rss %llu\n", stats[i].val); if (stats[i].tag =3D=3D VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE) 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); } =20 ret =3D true; diff --git a/tools/virsh.pod b/tools/virsh.pod index dc100db9f3..50799cf588 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -924,6 +924,8 @@ B: usable - The amount of memory which can be reclaimed by ballo= on 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) =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 @@ -1030,6 +1032,9 @@ I<--balloon> returns: balloon without causing host swapping (in KiB) "balloon.last-update" - timestamp of the last update of statistics (in seconds) + "balloon.disk_caches " - the amount of memory that can be reclaimed + without additional I/O, typically disk + caches (in KiB) =20 I<--vcpu> returns: =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list