• zhenwei pi's avatar
    virtio_balloon: introduce memory scan/reclaim info · 74c025c5
    zhenwei pi authored
    Expose memory scan/reclaim information to the host side via virtio
    balloon device.
    
    Now we have a metric to analyze the memory performance:
    
    y: counter increases
    n: counter does not changes
    h: the rate of counter change is high
    l: the rate of counter change is low
    
    OOM: VIRTIO_BALLOON_S_OOM_KILL
    STALL: VIRTIO_BALLOON_S_ALLOC_STALL
    ASCAN: VIRTIO_BALLOON_S_SCAN_ASYNC
    DSCAN: VIRTIO_BALLOON_S_SCAN_DIRECT
    ARCLM: VIRTIO_BALLOON_S_RECLAIM_ASYNC
    DRCLM: VIRTIO_BALLOON_S_RECLAIM_DIRECT
    
    - OOM[y], STALL[*], ASCAN[*], DSCAN[*], ARCLM[*], DRCLM[*]:
      the guest runs under really critial memory pressure
    
    - OOM[n], STALL[h], ASCAN[*], DSCAN[l], ARCLM[*], DRCLM[l]:
      the memory allocation stalls due to cgroup, not the global memory
      pressure.
    
    - OOM[n], STALL[h], ASCAN[*], DSCAN[h], ARCLM[*], DRCLM[h]:
      the memory allocation stalls due to global memory pressure. The
      performance gets hurt a lot. A high ratio between DRCLM/DSCAN shows
      quite effective memory reclaiming.
    
    - OOM[n], STALL[h], ASCAN[*], DSCAN[h], ARCLM[*], DRCLM[l]:
      the memory allocation stalls due to global memory pressure.
      the ratio between DRCLM/DSCAN gets low, the guest OS is thrashing
      heavily, the serious case leads poor performance and difficult
      trouble shooting. Ex, sshd may block on memory allocation when
      accepting new connections, a user can't login a VM by ssh command.
    
    - OOM[n], STALL[n], ASCAN[h], DSCAN[n], ARCLM[l], DRCLM[n]:
      the low ratio between ARCLM/ASCAN shows that the guest tries to
      reclaim more memory, but it can't. Once more memory is required in
      future, it will struggle to reclaim memory.
    Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
    Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
    Message-Id: <20240423034109.1552866-5-pizhenwei@bytedance.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    74c025c5
virtio_balloon.c 35.3 KB