virtio_balloon shared and unevictable stats

This CL adds support for parsing stats introduced by:
https://crrev.com/c/3115084

BUG=b:198468047
TEST=candy crush runs

Change-Id: I8e258ebf7f2b7dd7a3019f40397c59514e7b18bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3168561
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Charles William Dick <cwd@google.com>
This commit is contained in:
Charles William Dick 2021-09-21 13:47:36 +09:00 committed by Commit Bot
parent 127a90ff3e
commit 4745f03ce0
2 changed files with 6 additions and 0 deletions

View file

@ -79,6 +79,8 @@ const VIRTIO_BALLOON_S_AVAIL: u16 = 6;
const VIRTIO_BALLOON_S_CACHES: u16 = 7;
const VIRTIO_BALLOON_S_HTLB_PGALLOC: u16 = 8;
const VIRTIO_BALLOON_S_HTLB_PGFAIL: u16 = 9;
const VIRTIO_BALLOON_S_NONSTANDARD_SHMEM: u16 = 65534;
const VIRTIO_BALLOON_S_NONSTANDARD_UNEVICTABLE: u16 = 65535;
// BalloonStat is used to deserialize stats from the stats_queue.
#[derive(Copy, Clone)]
@ -104,6 +106,8 @@ impl BalloonStat {
VIRTIO_BALLOON_S_CACHES => stats.disk_caches = val,
VIRTIO_BALLOON_S_HTLB_PGALLOC => stats.hugetlb_allocations = val,
VIRTIO_BALLOON_S_HTLB_PGFAIL => stats.hugetlb_failures = val,
VIRTIO_BALLOON_S_NONSTANDARD_SHMEM => stats.shared_memory = val,
VIRTIO_BALLOON_S_NONSTANDARD_UNEVICTABLE => stats.unevictable_memory = val,
_ => (),
}
}

View file

@ -141,6 +141,8 @@ pub struct BalloonStats {
pub disk_caches: Option<u64>,
pub hugetlb_allocations: Option<u64>,
pub hugetlb_failures: Option<u64>,
pub shared_memory: Option<u64>,
pub unevictable_memory: Option<u64>,
}
// BalloonControlResult holds results for BalloonControlCommand defined above.