xref: /aosp_15_r20/external/crosvm/docs/book/src/devices/balloon.md (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1# Balloon
2
3crosvm supports
4[virtio-balloon](https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.html#x1-2790005)
5for managing guest memory.
6
7## How to control the balloon size
8
9When running a VM, specify `VM_SOCKET` with `-s` option. (example: `/run/crosvm.sock`)
10
11```sh
12crosvm run \
13    -s ${CROSVM_SOCKET} \
14    # usual crosvm args
15    /path/to/bzImage
16```
17
18Then, open another terminal and specify the balloon size in bytes with `crosvm balloon` command.
19
20```sh
21crosvm balloon 4096 ${CROSVM_SOCKET}
22```
23
24Note: The size of balloon is managed in 4096 bytes units. The specified value will be rounded down
25to a multiple of 4096 bytes.
26
27You can confirm the balloon size with `crosvm balloon_stats` command.
28
29```sh
30crosvm balloon_stats ${CROSVM_SOCKET}
31```
32