diff options
Diffstat (limited to 'drivers/virtio/virtio_balloon.c')
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 0c3691f46575..f2b77dea8d3c 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/balloon_compaction.h> | 30 | #include <linux/balloon_compaction.h> |
31 | #include <linux/oom.h> | 31 | #include <linux/oom.h> |
32 | #include <linux/wait.h> | 32 | #include <linux/wait.h> |
33 | #include <linux/mm.h> | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * Balloon device works in 4K page units. So each page is pointed to by | 36 | * Balloon device works in 4K page units. So each page is pointed to by |
@@ -229,10 +230,13 @@ static void update_balloon_stats(struct virtio_balloon *vb) | |||
229 | unsigned long events[NR_VM_EVENT_ITEMS]; | 230 | unsigned long events[NR_VM_EVENT_ITEMS]; |
230 | struct sysinfo i; | 231 | struct sysinfo i; |
231 | int idx = 0; | 232 | int idx = 0; |
233 | long available; | ||
232 | 234 | ||
233 | all_vm_events(events); | 235 | all_vm_events(events); |
234 | si_meminfo(&i); | 236 | si_meminfo(&i); |
235 | 237 | ||
238 | available = si_mem_available(); | ||
239 | |||
236 | update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN, | 240 | update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN, |
237 | pages_to_bytes(events[PSWPIN])); | 241 | pages_to_bytes(events[PSWPIN])); |
238 | update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_OUT, | 242 | update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_OUT, |
@@ -243,6 +247,8 @@ static void update_balloon_stats(struct virtio_balloon *vb) | |||
243 | pages_to_bytes(i.freeram)); | 247 | pages_to_bytes(i.freeram)); |
244 | update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMTOT, | 248 | update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMTOT, |
245 | pages_to_bytes(i.totalram)); | 249 | pages_to_bytes(i.totalram)); |
250 | update_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL, | ||
251 | pages_to_bytes(available)); | ||
246 | } | 252 | } |
247 | 253 | ||
248 | /* | 254 | /* |