This series extends the virtio-balloon stats virtqueue with new tags
for memory composition and pressure data, and adds an optional push
mode for guest-initiated stat reporting.

Patch 1 adds 11 new stat tags to the existing stats VQ.

  These use the same tag/value format and require no feature negotiation.
  Old hosts ignore unknown tags.

  The new tags provide data needed for better balloon sizing:

  a) dirty/writeback pages (more accurate reclaimable estimates)
  b) workingset refault counters (balloon overshoot before PSI spikes)
  c) PSI pressure stats

  Also exports psi_system for module builds.

Patch 2 adds VIRTIO_BALLOON_F_STATS_PUSH.

  Stats push is a new feature that lets the host configure the guest
  to push stats on a timer. The host sets stats_push_interval_ms in
  the balloon config space; when non-zero, the guest pushes stats at
  that cadence without waiting for the host to return the buffer. 

  This serves two purposes: 
    a) latency-sensitive consumers get stats at a guaranteed cadence
    b) absence of expected stats provides guest liveness detection.

  STATS_PUSH requires STATS_VQ and suppresses the pull callback when
  active to avoid racing on buffer submission.

Gregory Price (2):
  virtio-balloon: extend stats with memory composition and pressure data
  virtio-balloon: add stats push mode

 drivers/virtio/virtio_balloon.c     | 104 ++++++++++++++++++++++++++++
 include/uapi/linux/virtio_balloon.h |  33 ++++++++-
 kernel/sched/psi.c                  |   1 +
 3 files changed, 136 insertions(+), 2 deletions(-)

-- 
2.54.0


Reply via email to