Memory Ballooning

Definition

Memory ballooning uses a cooperating guest driver to help the host reclaim memory from a running guest. The lecture presents it as a PV-only device supporting memory management and overcommitment.

Lecture motivation

The VM is configured with a memory size, but the VMM does not automatically know which guest pages are dispensable. A guest-aware driver can supply memory information and cooperate in reclaiming backing memory.

Study intuition

An inflated balloon occupies pages inside the guest, making them unavailable to ordinary guest workloads while allowing backing resources to be reclaimed by the host. Deflating returns capacity to the guest. Guest memory statistics are a related capability, rather than the whole reclamation mechanism.

QEMU separately documents polling the balloon driver for guest memory statistics. QEMU balloon statistics. The OASIS specification distinguishes supplying pages to the balloon (inflate) from withdrawing them for reuse (deflate). Virtio 1.0 specification, section 5.5.

Study example

Two guests are configured for up to 8 GiB each on a host with less than 16 GiB available for them. If their actual needs are low and reclaimable, cooperative memory management may make this practical. If both need their full allocation at once, overcommitment does not create extra physical RAM.

Important rules

  • Guest driver support is needed for this cooperative mechanism.
  • Configured capacity, guest-visible usable memory, and physical host backing are different quantities.
  • Overcommitment requires managing actual demand and memory pressure.
  • Ballooning is not the same as EPT: one manages memory availability, the other translates addresses.

Common mistakes

  • Treating ballooning as merely reading a usage counter.
  • Assuming guest free memory is automatically reclaimed by every host configuration.
  • Assuming overcommitted allocations can all be fully resident simultaneously.

Related: Memory Virtualization - Shadow Page Tables and EPT, Paravirtualization and Hypercalls, Virtio Virtqueues and vhost-net.

Source

Lecture 03 PDF pages 56, 58, and 92 (printed slides 59, 61, 98). Context: Lecture 03 - Computing Virtualization Technologies and Tools. The inflate/deflate explanation, example, and distinctions are additional study guidance; QEMU documentation and the OASIS specification are linked above.