提交 b4000032 编写于 作者: M Michael S. Tsirkin

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 6c64fe7f
("virtio_balloon: export hugetlb page allocation counts").

Let's add an array of reasonably readable names.

Fixes: 6c64fe7f ("virtio_balloon: export hugetlb page allocation counts")
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NJonathan Helman <jonathan.helman@oracle.com>
上级 6d08b06e
...@@ -57,6 +57,21 @@ struct virtio_balloon_config { ...@@ -57,6 +57,21 @@ struct virtio_balloon_config {
#define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */ #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
#define VIRTIO_BALLOON_S_NR 10 #define VIRTIO_BALLOON_S_NR 10
#define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \
VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \
VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \
VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \
VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \
VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \
VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \
VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \
VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \
VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \
VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \
}
#define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("")
/* /*
* Memory statistics structure. * Memory statistics structure.
* Driver fills an array of these structures and passes to device. * Driver fills an array of these structures and passes to device.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册