[Devel] [PATCH RHEL9 COMMIT] FD: balloon: usage information visible by guest: stats reported in OOM/SysRQ

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 17 16:20:55 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-70.22.1.vz9.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-70.22.1.vz9.17.7
------>
commit 3851265540275fe1bb7e3a50d3022d508bcaaf5e
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Oct 17 16:17:02 2022 +0300

    FD: balloon: usage information visible by guest: stats reported in OOM/SysRQ
    
    Added info that mem_show() now prints balloon stats, in particular this
    covers OOM reports and Alt+SysRQ+m cases.
    
    https://jira.sw.ru/browse/PSBM-142436
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    
    Feature: balloon: usage information visible by guest
---
 .../balloon-usage_information_visible_by_guest.rst | 95 +++++++++++++++++-----
 1 file changed, 76 insertions(+), 19 deletions(-)

diff --git a/Documentation/Virtuozzo/FeatureDescriptions/balloon-usage_information_visible_by_guest.rst b/Documentation/Virtuozzo/FeatureDescriptions/balloon-usage_information_visible_by_guest.rst
index 30afdc1acee5..8f476bc8a893 100644
--- a/Documentation/Virtuozzo/FeatureDescriptions/balloon-usage_information_visible_by_guest.rst
+++ b/Documentation/Virtuozzo/FeatureDescriptions/balloon-usage_information_visible_by_guest.rst
@@ -9,38 +9,33 @@ The ballooning mechanism allows VM guests to reduce their memory size
 (thus relinquishing memory to the Host) and to increase it back (thus
 taking memory from the Host).
 
-During OOM guest issues or even just Guet low performance issues
+During OOM guest issues or even just Guest low performance issues
 investigations it is important to know if the Host grabs some Guest
 memory via ballooning mechanism.
 
 Implementation description:
 ===========================
 
-VMware  balloon guest file: /sys/kernel/debug/vmmemctl
-Hyper-V balloon guest file: /sys/kernel/debug/hv-balloon
 KVM     balloon guest file: /sys/kernel/debug/virtio-balloon
+Hyper-V balloon guest file: /sys/kernel/debug/hv-balloon
+VMware  balloon guest file: /sys/kernel/debug/vmmemctl
 
 VMware balloon guest file presents for a long time already,
 while Hyper-V and KVM balloon guest files were added recently.
 
-Hyper-V balloon
----------------
 
-Balloon guest statistics output example::
+The balloon statistics now is also printed by show_mem() function, which
+in particular is called when OOM happens or Alt+SysRQ+m is pressed.
 
-  # cat /sys/kernel/debug/hv-balloon
-  host_version : 2.0                // Hyper-V version the Guest is running under
-  capabilities : enabled hot_add
-  state : 1 (Initialized)
-  page_size : 4096
-  pages_added : 0                   // pages that are hot_add-ed to the Guest
-  pages_onlined : 0                 // pages that are added and then put online
-                                    // as available/used
-  pages_ballooned_out : 0           // pages the Host have taken back
-  vm_pages_commited : 795365        // total pages used by the Guest userspace
-  total_pages_commited : 977790     // total pages used by the Guest user+kernel
-  max_dynamic_page_count: 268435456 // maximum pages the Guest can have added
-                                    // via hot_add
+The show_mem() string looks like::
+
+  Balloon InflatedTotal:XXXkB InflatedFree:YYYkB
+
+- Non-zero "InflatedTotal" counter means the provided amount of memory
+  is subtracted from total RAM reported inside the Guest.
+
+- Non-zero "InflatedFree" counter means the provided amount of memory
+  is accounted as "used" inside the Guest.
 
 KVM balloon
 -----------
@@ -98,6 +93,68 @@ How to find virtio balloon device among other virtio devices?
 
 - Both "InflatedTotal" and "InflatedFree" cannot be non-zero at the same time.
 
+Hyper-V balloon
+---------------
+
+Balloon guest statistics output example::
+
+  # cat /sys/kernel/debug/hv-balloon
+  host_version : 2.0                // Hyper-V version the Guest is running under
+  capabilities : enabled hot_add
+  state : 1 (Initialized)
+  page_size : 4096
+  pages_added : 0                   // pages that are hot_add-ed to the Guest
+  pages_onlined : 0                 // pages that are added and then put online
+                                    // as available/used
+  pages_ballooned_out : 0           // pages the Host have taken back
+  vm_pages_commited : 795365        // total pages used by the Guest userspace
+  total_pages_commited : 977790     // total pages used by the Guest user+kernel
+  max_dynamic_page_count: 268435456 // maximum pages the Guest can have added
+                                    // via hot_add
+
+Hyper-V balloon driver changes TOTAL RAM size reported by the Guest,
+thus the "InflatedTotal" counter will be non-zero in memory statistic
+reported during OOM or upon Alt+SysRQ+m.
+
+Hyper-V balloon
+---------------
+
+Balloon guest statistics output example::
 
+  # cat /sys/kernel/debug/vmmemctl
+  balloon capabilities: 0x1e
+  used capabilities: 0x6
+  is resetting: n
+  target: 0 pages
+  current: 0 pages
+  rateSleepAlloc: 2048 pages/sec
+
+  timer: 118
+  doorbell: 0
+  start: 1 ( 0 failed)
+  guestType: 1 ( 0 failed)
+  2m-lock: 0 ( 0 failed)
+  lock: 0 ( 0 failed)
+  2m-unlock: 0 ( 0 failed)
+  unlock: 0 ( 0 failed)
+  target: 118 ( 0 failed)
+  prim2mAlloc: 0 ( 0 failed)
+  primNoSleepAlloc: 0 ( 0 failed)
+  primCanSleepAlloc: 0 ( 0 failed)
+  prim2mFree: 0
+  primFree: 0
+  err2mAlloc: 0
+  errAlloc: 0
+  err2mFree: 0
+  errFree: 0
+  doorbellSet: 0
+  doorbellUnset: 1
+
+VMware balloon driver makes ballooned pages accounted as "used" in the
+Guest OS thus the "InflatedFree" counter will be non-zero in memory
+statistic reported during OOM or upon Alt+SysRQ+m.
+
+https://jira.sw.ru/browse/PSBM-140408
 https://jira.sw.ru/browse/PSBM-140409
 https://jira.sw.ru/browse/PSBM-140407
+https://jira.sw.ru/browse/PSBM-142436


More information about the Devel mailing list