mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: Add entry for balloon stats stat-htlb-pgalloc and stat-htlb-pgfail
Qemu added reporting of virtio balloon new statistics stat-htlb-pgalloc and stat-htlb-pgfail since qemu-3.0 commit b7b12644297. The value of stat-htlb-pgalloc represents the number of successful hugetlb page allocations while stat-htlb-pgfail represents the number of failed ones. Add this statistics reporting to libvirt. To enable this feature for vm, guest kenel >= 4.17 is required because the exporting hugetlb page allocation for virtio balloon is introduced since 6c64fe7f. Signed-off-by: Han Han <hhan@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
dfd70ca1eb
commit
a699b19f6c
@ -636,11 +636,23 @@ typedef enum {
|
||||
*/
|
||||
VIR_DOMAIN_MEMORY_STAT_DISK_CACHES = 10,
|
||||
|
||||
/*
|
||||
* The amount of successful huge page allocations from inside the domain via
|
||||
* virtio balloon.
|
||||
*/
|
||||
VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC = 11,
|
||||
|
||||
/*
|
||||
* The amount of failed huge page allocations from inside the domain via
|
||||
* virtio balloon.
|
||||
*/
|
||||
VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL = 12,
|
||||
|
||||
/*
|
||||
* The number of statistics supported by this version of the interface.
|
||||
* To add new statistics, add them to the enum and increase this value.
|
||||
*/
|
||||
VIR_DOMAIN_MEMORY_STAT_NR = 11,
|
||||
VIR_DOMAIN_MEMORY_STAT_NR = 13,
|
||||
|
||||
# ifdef VIR_ENUM_SENTINELS
|
||||
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
|
||||
|
@ -5734,6 +5734,10 @@ virDomainGetInterfaceParameters(virDomainPtr domain,
|
||||
* VIR_DOMAIN_MEMORY_STAT_DISK_CACHES
|
||||
* Memory that can be reclaimed without additional I/O, typically disk
|
||||
* caches (in kb).
|
||||
* VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC
|
||||
* The amount of successful huge page allocations from inside the domain
|
||||
* VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL
|
||||
* The amount of failed huge page allocations from inside the domain
|
||||
*
|
||||
* Returns: The number of stats provided or -1 in case of failure.
|
||||
*/
|
||||
|
@ -20248,6 +20248,8 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver,
|
||||
STORE_MEM_RECORD(LAST_UPDATE, "last-update")
|
||||
STORE_MEM_RECORD(USABLE, "usable")
|
||||
STORE_MEM_RECORD(DISK_CACHES, "disk_caches")
|
||||
STORE_MEM_RECORD(HUGETLB_PGALLOC, "hugetlb_pgalloc")
|
||||
STORE_MEM_RECORD(HUGETLB_PGFAIL, "hugetlb_pgfail")
|
||||
}
|
||||
|
||||
#undef STORE_MEM_RECORD
|
||||
|
@ -2150,6 +2150,11 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
|
||||
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 1);
|
||||
GET_BALLOON_STATS(statsdata, "stat-disk-caches",
|
||||
VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, 1024);
|
||||
GET_BALLOON_STATS(statsdata, "stat-htlb-pgalloc",
|
||||
VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC, 1);
|
||||
GET_BALLOON_STATS(statsdata, "stat-htlb-pgfail",
|
||||
VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL, 1);
|
||||
|
||||
ret = got;
|
||||
cleanup:
|
||||
virJSONValueFree(cmd);
|
||||
|
@ -376,6 +376,10 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
|
||||
vshPrint(ctl, "last_update %llu\n", stats[i].val);
|
||||
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_DISK_CACHES)
|
||||
vshPrint(ctl, "disk_caches %llu\n", stats[i].val);
|
||||
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC)
|
||||
vshPrint(ctl, "hugetlb_pgalloc %llu\n", stats[i].val);
|
||||
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL)
|
||||
vshPrint(ctl, "hugetlb_pgfail %llu\n", stats[i].val);
|
||||
}
|
||||
|
||||
ret = true;
|
||||
|
@ -938,6 +938,10 @@ without causing host swapping (in KiB)
|
||||
last-update - Timestamp of the last update of statistics (in seconds)
|
||||
disk_caches - The amount of memory that can be reclaimed without
|
||||
additional I/O, typically disk caches (in KiB)
|
||||
hugetlb_pgalloc - The number of successful huge page allocations initiated
|
||||
from within the domain
|
||||
hugetlb_pgfail - The number of failed huge page allocations initiated from
|
||||
within the domain
|
||||
|
||||
For QEMU/KVM with a memory balloon, setting the optional I<--period> to a
|
||||
value larger than 0 in seconds will allow the balloon driver to return
|
||||
|
Loading…
Reference in New Issue
Block a user