aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2018-04-13 09:37:04 -0400
committerMichael S. Tsirkin <mst@redhat.com>2018-04-24 14:44:01 -0400
commitb40000325044433cd350725e2025214ae48b17fd (patch)
tree7349819d26c66e3bacd07873ee3e802dab2cfcb0
parent6d08b06e67cd117f6992c46611dfb4ce267cd71e (diff)
virtio_balloon: add array of stat names
Jason Wang points out that it's very hard for users to build an array of stat names. The naive thing is to use VIRTIO_BALLOON_S_NR but that breaks if we add more stats - as done e.g. recently by commit 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts"). Let's add an array of reasonably readable names. Fixes: 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts") Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Jonathan Helman <jonathan.helman@oracle.com>
-rw-r--r--include/uapi/linux/virtio_balloon.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
index 40297a3181ed..13b8cb563892 100644
--- a/include/uapi/linux/virtio_balloon.h
+++ b/include/uapi/linux/virtio_balloon.h
@@ -57,6 +57,21 @@ struct virtio_balloon_config {
57#define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */ 57#define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
58#define VIRTIO_BALLOON_S_NR 10 58#define VIRTIO_BALLOON_S_NR 10
59 59
60#define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \
61 VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \
62 VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \
63 VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \
64 VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \
65 VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \
66 VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \
67 VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \
68 VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \
69 VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \
70 VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \
71}
72
73#define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("")
74
60/* 75/*
61 * Memory statistics structure. 76 * Memory statistics structure.
62 * Driver fills an array of these structures and passes to device. 77 * Driver fills an array of these structures and passes to device.