Skip to contentSkip to conversation

virtio-balloon: add huge page allocation statistics

PATCH New Jonathan Helman 1 participant 1 message Feb 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-balloon: add huge page allocation statistics

qemu should read and report huge page allocation statistics exported in the following kernel patch:

commit 01be4bb1aafeab73feba628c6dd120cd6647faae
Author: Jonathan Helman <[email protected]>
Date: Thu Feb 15 10:59:03 2018 -0800

virtio_balloon: export huge page allocation statistics

Export statistics for successful and failed huge page allocations from the virtio balloon driver. These 2 stats come directly from the vm_events HTLB_BUDDY_PGALLOC and HTLB_BUDDY_PGALLOC_FAIL.

---
 docs/virtio-balloon-stats.txt                   | 2 ++
 hw/virtio/virtio-balloon.c                      | 2 ++
 include/standard-headers/linux/virtio_balloon.h | 4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)
docs/virtio-balloon-stats.txt +2 -0
index edff5f2..12d33a7 100644
@@ -32,6 +32,8 @@ which will return a dictionary containing:
       - stat-minor-faults
       - stat-free-memory
       - stat-total-memory
+      - stat-htlb-pgalloc
+      - stat-htlb-pgfail
 
   o A key named last-update, which contains the last stats update
     timestamp in seconds. Since this timestamp is generated by the host,
hw/virtio/virtio-balloon.c +2 -0
index 4822449..f4f2b98 100644
@@ -52,6 +52,8 @@ static const char *balloon_stat_names[] = {
    [VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory",
    [VIRTIO_BALLOON_S_AVAIL] = "stat-available-memory",
    [VIRTIO_BALLOON_S_CACHES] = "stat-disk-caches",
+   [VIRTIO_BALLOON_S_HTLB_PGALLOC] = "stat-htlb-pgalloc",
+   [VIRTIO_BALLOON_S_HTLB_PGFAIL] = "stat-htlb-pgfail",
    [VIRTIO_BALLOON_S_NR] = NULL
 };
 
include/standard-headers/linux/virtio_balloon.h +3 -1
index 7b0a41b..ed445b6 100644
@@ -53,7 +53,9 @@ struct virtio_balloon_config {
 #define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
 #define VIRTIO_BALLOON_S_AVAIL    6   /* Available memory as in /proc */
 #define VIRTIO_BALLOON_S_CACHES   7   /* Disk caches */
-#define VIRTIO_BALLOON_S_NR       8
+#define VIRTIO_BALLOON_S_HTLB_PGALLOC  8  /* Number of htlb pgalloc successes */
+#define VIRTIO_BALLOON_S_HTLB_PGFAIL   9  /* Number of htlb pgalloc failures */
+#define VIRTIO_BALLOON_S_NR       10
 
 /*
  * Memory statistics structure.
Signature · 1 line
1.8.3.1