]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Add entry for balloon stat stat-disk-caches
authorTomáš Golembiovský <tgolembi@redhat.com>
Mon, 2 Jul 2018 11:19:42 +0000 (13:19 +0200)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 16 Jul 2018 21:42:23 +0000 (17:42 -0400)
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áš Golembiovský <tgolembi@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
include/libvirt/libvirt-domain.h
src/libvirt-domain.c
src/qemu/qemu_driver.c
src/qemu/qemu_monitor_json.c
tools/virsh-domain-monitor.c
tools/virsh.pod

index 796f2e140883abb1582ee07f4a1f73e1954a1b83..fdd2d6b8eac7ff075d9a48172868162af7a529c3 100644 (file)
@@ -628,11 +628,18 @@ typedef enum {
     /* Timestamp of the last update of statistics, in seconds. */
     VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE     = 9,
 
+    /*
+     * 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     = 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              = 10,
+    VIR_DOMAIN_MEMORY_STAT_NR              = 11,
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
index ab7266dc19ed8d5abe56df790c45113a1372ad8b..ef460277f708aa941256be1d4ce73fc5262a67e3 100644 (file)
@@ -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.
  */
index 8fae46370e40bc887bb46e9de91ffd7b10eedb5c..847dab2edc8fd45616c2c029dd30f8c9526f7953 100644 (file)
@@ -19798,6 +19798,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")
     }
 
 #undef STORE_MEM_RECORD
index fc2d6c74a74290ae28dddac6889df64d5b21e7db..cc3c8f2dd6108c3eea39844dd2cffa9e2e23814f 100644 (file)
@@ -2081,6 +2081,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 = got;
  cleanup:
     virJSONValueFree(cmd);
index 87660ee67404f6802a956f7ef3cf4d104875fc73..b9b4f9739b75e52590023f02bd0540a75064b7eb 100644 (file)
@@ -364,6 +364,8 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
             vshPrint(ctl, "rss %llu\n", stats[i].val);
         if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE)
             vshPrint(ctl, "last_update %llu\n", stats[i].val);
+        if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_DISK_CACHES)
+            vshPrint(ctl, "disk_caches %llu\n", stats[i].val);
     }
 
     ret = true;
index 771e99591e85de65c40b2d72b5733b9dc61a1f03..9ac4946337015f5fcce04dde794198a0c5a59718 100644 (file)
@@ -924,6 +924,8 @@ B<Explanation of fields>:
   usable            - The amount of memory which can be reclaimed by balloon
 without causing host swapping (in KiB)
   last-update       - Timestamp of the last update of statistics (in seconds)
+  disk_caches       - The amount of memory that can be reclaimed without
+additional I/O, typically disk caches (in KiB)
 
 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)
 
 I<--vcpu> returns: