Jonathan Helman
2018-Feb-17 05:44 UTC
[PATCH] 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. Signed-off-by: Jonathan Helman <jonathan.helman at oracle.com> --- drivers/virtio/virtio_balloon.c | 6 ++++++ include/uapi/linux/virtio_balloon.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index dfe5684..6b237e3 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -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)); diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h index 4e8b830..e3e8071 100644 --- a/include/uapi/linux/virtio_balloon.h +++ b/include/uapi/linux/virtio_balloon.h @@ -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. -- 1.8.3.1
Michael S. Tsirkin
2018-Feb-27 15:20 UTC
[PATCH] virtio_balloon: export huge page allocation statistics
On Fri, Feb 16, 2018 at 09:44:32PM -0800, Jonathan Helman wrote:> 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. > Signed-off-by: Jonathan Helman <jonathan.helman at oracle.com>Any host/guest intergace changes need to be copied to the virtio TC mailing list (subscriber-only, sorry about that): virtio-dev at lists.oasis-open.org> --- > drivers/virtio/virtio_balloon.c | 6 ++++++ > include/uapi/linux/virtio_balloon.h | 4 +++- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c > index dfe5684..6b237e3 100644 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -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)); > diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h > index 4e8b830..e3e8071 100644 > --- a/include/uapi/linux/virtio_balloon.h > +++ b/include/uapi/linux/virtio_balloon.h > @@ -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 10Can you clarify the comments pls? Eschew abbreviation.> > /* > * Memory statistics structure. > -- > 1.8.3.1
Jonathan Helman
2018-Mar-02 22:16 UTC
[PATCH] virtio_balloon: export huge page allocation statistics
On 02/27/2018 07:20 AM, Michael S. Tsirkin wrote:> On Fri, Feb 16, 2018 at 09:44:32PM -0800, Jonathan Helman wrote: >> 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. >> Signed-off-by: Jonathan Helman <jonathan.helman at oracle.com> > > Any host/guest intergace changes need to be copied to > the virtio TC mailing list (subscriber-only, sorry about that): > virtio-dev at lists.oasis-open.org >Sorry, will do on v2.>> --- >> drivers/virtio/virtio_balloon.c | 6 ++++++ >> include/uapi/linux/virtio_balloon.h | 4 +++- >> 2 files changed, 9 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c >> index dfe5684..6b237e3 100644 >> --- a/drivers/virtio/virtio_balloon.c >> +++ b/drivers/virtio/virtio_balloon.c >> @@ -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)); >> diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h >> index 4e8b830..e3e8071 100644 >> --- a/include/uapi/linux/virtio_balloon.h >> +++ b/include/uapi/linux/virtio_balloon.h >> @@ -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.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> >> >> /* >> * Memory statistics structure. >> -- >> 1.8.3.1
Reasonably Related Threads
- [PATCH] virtio_balloon: export huge page allocation statistics
- [PATCH v2] virtio_balloon: export hugetlb page allocation counts
- [PATCH v2] virtio_balloon: export hugetlb page allocation counts
- [PATCH v2] virtio_balloon: export hugetlb page allocation counts
- [virtio-dev] Re: [PATCH v2] virtio_balloon: export hugetlb page allocation counts