History

virtio_balloon: introduce oom-kill invocations

When the guest OS runs under critical memory pressure, the guest starts to kill processes. A guest monitor agent may scan 'oom_kill' from /proc/vmstat, and reports the OOM KILL event. However, the agent may be killed and we will loss this critical event(and the later events). For now we can also grep for magic words in guest kernel log from host side. Rather than this unstable way, virtio balloon reports OOM-KILL invocations instead.

zhenwei pi committed 2 years ago

Commit 6cf1c971 parent e25fbcd2 files · +5 −2Browse files

Unified · Split

2 files
  1. drivers/virtio/virtio_balloon.c +1 −0
  2. include/uapi/linux/virtio_balloon.h +4 −2
drivers/virtio/virtio_balloon.c+1−0
@@ -363,6 +363,7 @@ static inline unsigned int update_balloon_vm_stats(struct virtio_balloon *vb) · 362 unmodified lines
363363 pages_to_bytes(events[PSWPOUT]));
364364 update_stat(vb, idx++, VIRTIO_BALLOON_S_MAJFLT, events[PGMAJFAULT]);
365365 update_stat(vb, idx++, VIRTIO_BALLOON_S_MINFLT, events[PGFAULT]);
366+ update_stat(vb, idx++, VIRTIO_BALLOON_S_OOM_KILL, events[OOM_KILL]);
366367
367368 #ifdef CONFIG_HUGETLB_PAGE
368369 update_stat(vb, idx++, VIRTIO_BALLOON_S_HTLB_PGALLOC,
include/uapi/linux/virtio_balloon.h+4−2
@@ -71,7 +71,8 @@ struct virtio_balloon_config { · 70 unmodified lines
7171 #define VIRTIO_BALLOON_S_CACHES 7 /* Disk caches */
7272 #define VIRTIO_BALLOON_S_HTLB_PGALLOC 8 /* Hugetlb page allocations */
7373 #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
74−#define VIRTIO_BALLOON_S_NR 10
74+#define VIRTIO_BALLOON_S_OOM_KILL 10 /* OOM killer invocations */
75+#define VIRTIO_BALLOON_S_NR 11
7576
7677 #define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \
7778 VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \
@@ -83,7 +84,8 @@ struct virtio_balloon_config { · 5 unmodified lines
8384 VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \
8485 VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \
8586 VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \
86− VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \
87+ VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures", \
88+ VIRTIO_BALLOON_S_NAMES_prefix "oom-kills" \
8789 }
8890
8991 #define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("")

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t