mirror of
https://github.com/torvalds/linux.git
synced 2024-09-21 07:23:06 +00:00
virtio_balloon: include disk/file caches memory statistics
Add a new field VIRTIO_BALLOON_S_CACHES to virtio_balloon memory statistics protocol. The value represents all disk/file caches. In this case it corresponds to the sum of values Buffers+Cached+SwapCached from /proc/meminfo. Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
d8a5b80568
commit
4d32029b8d
|
@ -257,11 +257,13 @@ static unsigned int update_balloon_stats(struct virtio_balloon *vb)
|
||||||
struct sysinfo i;
|
struct sysinfo i;
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
long available;
|
long available;
|
||||||
|
unsigned long caches;
|
||||||
|
|
||||||
all_vm_events(events);
|
all_vm_events(events);
|
||||||
si_meminfo(&i);
|
si_meminfo(&i);
|
||||||
|
|
||||||
available = si_mem_available();
|
available = si_mem_available();
|
||||||
|
caches = global_node_page_state(NR_FILE_PAGES);
|
||||||
|
|
||||||
#ifdef CONFIG_VM_EVENT_COUNTERS
|
#ifdef CONFIG_VM_EVENT_COUNTERS
|
||||||
update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN,
|
update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN,
|
||||||
|
@ -277,6 +279,8 @@ static unsigned int update_balloon_stats(struct virtio_balloon *vb)
|
||||||
pages_to_bytes(i.totalram));
|
pages_to_bytes(i.totalram));
|
||||||
update_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL,
|
update_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL,
|
||||||
pages_to_bytes(available));
|
pages_to_bytes(available));
|
||||||
|
update_stat(vb, idx++, VIRTIO_BALLOON_S_CACHES,
|
||||||
|
pages_to_bytes(caches));
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@ struct virtio_balloon_config {
|
||||||
#define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */
|
#define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */
|
||||||
#define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */
|
#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_AVAIL 6 /* Available memory as in /proc */
|
||||||
#define VIRTIO_BALLOON_S_NR 7
|
#define VIRTIO_BALLOON_S_CACHES 7 /* Disk caches */
|
||||||
|
#define VIRTIO_BALLOON_S_NR 8
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory statistics structure.
|
* Memory statistics structure.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user