]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
virtio_balloon: export hugetlb page allocation counts
authorJonathan Helman <jonathan.helman@oracle.com>
Mon, 19 Mar 2018 22:14:14 +0000 (15:14 -0700)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 10 Apr 2018 18:23:55 +0000 (21:23 +0300)
Export the number of successful and failed hugetlb page
allocations via the virtio balloon driver. These 2 counts
come directly from the vm_events HTLB_BUDDY_PGALLOC and
HTLB_BUDDY_PGALLOC_FAIL.

Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
drivers/virtio/virtio_balloon.c
include/uapi/linux/virtio_balloon.h

index dfe5684000beb4b3fadd9581712268d7d2715c17..6b237e3f4983046cdc8327b75c173952fbc23f86 100644 (file)
@@ -272,6 +272,12 @@ static unsigned int update_balloon_stats(struct virtio_balloon *vb)
                                pages_to_bytes(events[PSWPOUT]));
        update_stat(vb, idx++, VIRTIO_BALLOON_S_MAJFLT, events[PGMAJFAULT]);
        update_stat(vb, idx++, VIRTIO_BALLOON_S_MINFLT, events[PGFAULT]);
+#ifdef CONFIG_HUGETLB_PAGE
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_HTLB_PGALLOC,
+                   events[HTLB_BUDDY_PGALLOC]);
+       update_stat(vb, idx++, VIRTIO_BALLOON_S_HTLB_PGFAIL,
+                   events[HTLB_BUDDY_PGALLOC_FAIL]);
+#endif
 #endif
        update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMFREE,
                                pages_to_bytes(i.freeram));
index 4e8b8304b7939622a7f8590f052deee1f389d2b6..40297a3181ed8244fbb4492b34c0feed55612739 100644 (file)
@@ -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  /* Hugetlb page allocations */
+#define VIRTIO_BALLOON_S_HTLB_PGFAIL   9  /* Hugetlb page allocation failures */
+#define VIRTIO_BALLOON_S_NR       10
 
 /*
  * Memory statistics structure.