virtio_balloon: export huge page allocation statistics
Subsystems (2)
PATCH 1/1 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.
--- drivers/virtio/virtio_balloon.c | 6 ++++++ include/uapi/linux/virtio_balloon.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +6 -0
@@ -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));
include/uapi/linux/virtio_balloon.h +3 -1
@@ -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
Michael S. Tsirkin
maintainerQuoted 4 lines · Jonathan Helman
Export statistics for successful and failed huge page allocations from the virtio balloon driver. These 2 stats come directly from the
vm_eventsHTLB_BUDDY_PGALLOCandHTLB_BUDDY_PGALLOC_FAIL.Signed-off-by Jonathan Helman <[email protected]>
Any host/guest intergace changes need to be copied to the virtio TC mailing list (subscriber-only, sorry about that):
[email protected]
Quoted 27 lines
--- drivers/virtio/virtio_balloon.c | 6 ++++++ include/uapi/linux/virtio_balloon.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-)drivers/virtio/virtio_balloon.c +6
-0@@ -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));include/uapi/linux/virtio_balloon.h +0
-0
include/uapi/linux/virtio_balloon.h struct virtio_balloon_config { · line 58
Quoted 7 lines
include/uapi/linux/virtio_balloon.h +3
-1@@ -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
Can you clarify the comments pls? Eschew abbreviation.
Quoted 5 lines
include/uapi/linux/virtio_balloon.h +0
-0/* * Memory statistics structure. Signature · 1 line
1.8.3.1
Quoted 10 lines · Michael S. Tsirkin
Quoted 4 lines · Jonathan Helman
Export statistics for successful and failed huge page allocations from the virtio balloon driver. These 2 stats come directly from the
vm_eventsHTLB_BUDDY_PGALLOCandHTLB_BUDDY_PGALLOC_FAIL.Signed-off-by Jonathan Helman <[email protected]>Any host/guest intergace changes need to be copied to the virtio TC mailing list (subscriber-only, sorry about that):
[email protected]
Sorry, will do on v2.
Quoted 28 lines
Quoted 28 lines
--- drivers/virtio/virtio_balloon.c | 6 ++++++ include/uapi/linux/virtio_balloon.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-)drivers/virtio/virtio_balloon.c +6
-0@@ -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));include/uapi/linux/virtio_balloon.h +0
-0@@ -53,7 +53,9 @@ struct virtio_balloon_config {#define VIRTIO_BALLOON_S_MEMTOT 5/* Total amount of memory */
Quoted 8 lines
include/uapi/linux/virtio_balloon.h struct virtio_balloon_config { · line 58
Quoted 6 lines
include/uapi/linux/virtio_balloon.h +3
-1#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 10Can you clarify the comments pls? Eschew abbreviation.
Sure. How about the following instead? Hoping it makes things clearer, without going over the 80 character limit ;)
#define VIRTIO_BALLOON_S_HTLB_PGALLOC 8 /* Hugetlb page allocations */ #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
If this is better, I'll send out a v2.
Thanks,
Jon
Quoted 6 lines
Quoted 6 lines
include/uapi/linux/virtio_balloon.h +0
-0/* * Memory statistics structure. Signature · 1 line
1.8.3.1