|
|
99cbc7 |
From dafb35cfae38f63e861e16623f83392cac3b73dc Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <dafb35cfae38f63e861e16623f83392cac3b73dc@dist-git>
|
|
|
99cbc7 |
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= <tgolembi@redhat.com>
|
|
|
99cbc7 |
Date: Wed, 3 Apr 2019 13:19:17 +0200
|
|
|
99cbc7 |
Subject: [PATCH] qemu: Add entry for balloon stat stat-disk-caches
|
|
|
99cbc7 |
MIME-Version: 1.0
|
|
|
99cbc7 |
Content-Type: text/plain; charset=UTF-8
|
|
|
99cbc7 |
Content-Transfer-Encoding: 8bit
|
|
|
99cbc7 |
|
|
|
99cbc7 |
QEMU commit bf1e7140e adds reporting of new balloon statistic to QEMU
|
|
|
99cbc7 |
2.12. Value represents the amount of memory that can be quickly
|
|
|
99cbc7 |
reclaimed without additional I/O. Let's add that too.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit aee046550893e7c0e5ccb4861dd3f0715d31eeb7)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
https: //bugzilla.redhat.com/show_bug.cgi?id=1690122
|
|
|
99cbc7 |
Signed-off-by: Jaroslav Suchanek <jsuchane@redhat.com>
|
|
|
99cbc7 |
Message-Id: <1554290357-24601-1-git-send-email-jsuchane@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
include/libvirt/libvirt-domain.h | 9 ++++++++-
|
|
|
99cbc7 |
src/libvirt-domain.c | 3 +++
|
|
|
99cbc7 |
src/qemu/qemu_driver.c | 1 +
|
|
|
99cbc7 |
src/qemu/qemu_monitor_json.c | 2 ++
|
|
|
99cbc7 |
tools/virsh-domain-monitor.c | 2 ++
|
|
|
99cbc7 |
tools/virsh.pod | 5 +++++
|
|
|
99cbc7 |
6 files changed, 21 insertions(+), 1 deletion(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
|
|
|
99cbc7 |
index 796f2e1408..fdd2d6b8ea 100644
|
|
|
99cbc7 |
--- a/include/libvirt/libvirt-domain.h
|
|
|
99cbc7 |
+++ b/include/libvirt/libvirt-domain.h
|
|
|
99cbc7 |
@@ -628,11 +628,18 @@ typedef enum {
|
|
|
99cbc7 |
/* Timestamp of the last update of statistics, in seconds. */
|
|
|
99cbc7 |
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE = 9,
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+ /*
|
|
|
99cbc7 |
+ * The amount of memory, that can be quickly reclaimed without
|
|
|
99cbc7 |
+ * additional I/O (in kB). Typically these pages are used for caching files
|
|
|
99cbc7 |
+ * from disk.
|
|
|
99cbc7 |
+ */
|
|
|
99cbc7 |
+ VIR_DOMAIN_MEMORY_STAT_DISK_CACHES = 10,
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
/*
|
|
|
99cbc7 |
* The number of statistics supported by this version of the interface.
|
|
|
99cbc7 |
* To add new statistics, add them to the enum and increase this value.
|
|
|
99cbc7 |
*/
|
|
|
99cbc7 |
- VIR_DOMAIN_MEMORY_STAT_NR = 10,
|
|
|
99cbc7 |
+ VIR_DOMAIN_MEMORY_STAT_NR = 11,
|
|
|
99cbc7 |
|
|
|
99cbc7 |
# ifdef VIR_ENUM_SENTINELS
|
|
|
99cbc7 |
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
|
|
|
99cbc7 |
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
|
|
99cbc7 |
index 5f7f0bfeba..568023176b 100644
|
|
|
99cbc7 |
--- a/src/libvirt-domain.c
|
|
|
99cbc7 |
+++ b/src/libvirt-domain.c
|
|
|
99cbc7 |
@@ -5732,6 +5732,9 @@ virDomainGetInterfaceParameters(virDomainPtr domain,
|
|
|
99cbc7 |
* Current balloon value (in kb).
|
|
|
99cbc7 |
* VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE
|
|
|
99cbc7 |
* Timestamp of the last statistic
|
|
|
99cbc7 |
+ * VIR_DOMAIN_MEMORY_STAT_DISK_CACHES
|
|
|
99cbc7 |
+ * Memory that can be reclaimed without additional I/O, typically disk
|
|
|
99cbc7 |
+ * caches (in kb).
|
|
|
99cbc7 |
*
|
|
|
99cbc7 |
* Returns: The number of stats provided or -1 in case of failure.
|
|
|
99cbc7 |
*/
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
99cbc7 |
index 295613ba3c..99d0dad911 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_driver.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_driver.c
|
|
|
99cbc7 |
@@ -19788,6 +19788,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
STORE_MEM_RECORD(RSS, "rss")
|
|
|
99cbc7 |
STORE_MEM_RECORD(LAST_UPDATE, "last-update")
|
|
|
99cbc7 |
STORE_MEM_RECORD(USABLE, "usable")
|
|
|
99cbc7 |
+ STORE_MEM_RECORD(DISK_CACHES, "disk_caches")
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
#undef STORE_MEM_RECORD
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
|
|
99cbc7 |
index 8970d95584..438d82e194 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_monitor_json.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_monitor_json.c
|
|
|
99cbc7 |
@@ -2100,6 +2100,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
|
|
|
99cbc7 |
VIR_DOMAIN_MEMORY_STAT_USABLE, 1024);
|
|
|
99cbc7 |
GET_BALLOON_STATS(data, "last-update",
|
|
|
99cbc7 |
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 1);
|
|
|
99cbc7 |
+ GET_BALLOON_STATS(statsdata, "stat-disk-caches",
|
|
|
99cbc7 |
+ VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, 1024);
|
|
|
99cbc7 |
ret = got;
|
|
|
99cbc7 |
cleanup:
|
|
|
99cbc7 |
virJSONValueFree(cmd);
|
|
|
99cbc7 |
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
|
|
|
99cbc7 |
index 87660ee674..b9b4f9739b 100644
|
|
|
99cbc7 |
--- a/tools/virsh-domain-monitor.c
|
|
|
99cbc7 |
+++ b/tools/virsh-domain-monitor.c
|
|
|
99cbc7 |
@@ -364,6 +364,8 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
|
|
|
99cbc7 |
vshPrint(ctl, "rss %llu\n", stats[i].val);
|
|
|
99cbc7 |
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE)
|
|
|
99cbc7 |
vshPrint(ctl, "last_update %llu\n", stats[i].val);
|
|
|
99cbc7 |
+ if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_DISK_CACHES)
|
|
|
99cbc7 |
+ vshPrint(ctl, "disk_caches %llu\n", stats[i].val);
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
ret = true;
|
|
|
99cbc7 |
diff --git a/tools/virsh.pod b/tools/virsh.pod
|
|
|
99cbc7 |
index 3e9c264fe8..00cbee19b6 100644
|
|
|
99cbc7 |
--- a/tools/virsh.pod
|
|
|
99cbc7 |
+++ b/tools/virsh.pod
|
|
|
99cbc7 |
@@ -924,6 +924,8 @@ B<Explanation of fields>:
|
|
|
99cbc7 |
usable - The amount of memory which can be reclaimed by balloon
|
|
|
99cbc7 |
without causing host swapping (in KiB)
|
|
|
99cbc7 |
last-update - Timestamp of the last update of statistics (in seconds)
|
|
|
99cbc7 |
+ disk_caches - The amount of memory that can be reclaimed without
|
|
|
99cbc7 |
+additional I/O, typically disk caches (in KiB)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
For QEMU/KVM with a memory balloon, setting the optional I<--period> to a
|
|
|
99cbc7 |
value larger than 0 in seconds will allow the balloon driver to return
|
|
|
99cbc7 |
@@ -1030,6 +1032,9 @@ I<--balloon> returns:
|
|
|
99cbc7 |
balloon without causing host swapping (in KiB)
|
|
|
99cbc7 |
"balloon.last-update" - timestamp of the last update of statistics
|
|
|
99cbc7 |
(in seconds)
|
|
|
99cbc7 |
+ "balloon.disk_caches " - the amount of memory that can be reclaimed
|
|
|
99cbc7 |
+ without additional I/O, typically disk
|
|
|
99cbc7 |
+ caches (in KiB)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
I<--vcpu> returns:
|
|
|
99cbc7 |
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|