Projects/auto-ballooning: Difference between revisions

From KVM
No edit summary
 
No edit summary
Line 5: Line 5:
To help avoiding those scenarios, the hypervisor (eg. QEMU) could automatically inflate the guest's balloon (thus returning memory to the host). This will also require a method for automatically deflating the guest's memory, so that fairness is ensured and the guest kernel doesn't run itself into trouble.
To help avoiding those scenarios, the hypervisor (eg. QEMU) could automatically inflate the guest's balloon (thus returning memory to the host). This will also require a method for automatically deflating the guest's memory, so that fairness is ensured and the guest kernel doesn't run itself into trouble.


The object of this page is to collect ideas on how to implement auto-ballooning.
The goal of this page is to collect ideas on how to implement auto-ballooning.
Currently, there is only one proposal, which is the "automatic balance" idea,
Currently, there is only one proposal, which is the "automatic balance" idea,
mostly designed by Rik van Riel.
mostly designed by Rik van Riel.
Line 13: Line 13:
In automatic balance, the hypervisor (eg. QEMU) automatically inflates the guest balloon when the host kernel is under memory pressure. On the other hand, when the guest kernel is under memory pressure, it will automatically try to deflate its balloon (which possibly may have been inflated by the hypervisor).
In automatic balance, the hypervisor (eg. QEMU) automatically inflates the guest balloon when the host kernel is under memory pressure. On the other hand, when the guest kernel is under memory pressure, it will automatically try to deflate its balloon (which possibly may have been inflated by the hypervisor).


It's expected that automatic inflate and deflate can balance each other.
It's expected that inflate and deflate will automatically balance each other over time.


Next sections describe the implementation details of this idea.
Next sections describe the implementation details of this idea.
Line 21: Line 21:
There are three components needed to make auto-inflate work.
There are three components needed to make auto-inflate work.


1. A host kernel API to let user-space processes know when the kernel is facing memory pressure
* A host kernel API to let user-space processes know when the kernel is facing memory pressure (TODO: point to mempressure API)


2. QEMU changes to use the host kernel API, and to inflate the guest's balloon when the host kernel is facing memory pressure
* QEMU changes to use the host kernel API, and to inflate the guest's balloon when the host kernel is facing memory pressure


=== auto-deflate ===
=== auto-deflate ===
Line 29: Line 29:
Only one component is needed for auto-deflate:
Only one component is needed for auto-deflate:


1. The guest virtio-balloon driver must be changed to automatically deflate the balloon when the guest is facing memory pressure
* The guest virtio-balloon driver must be changed to automatically deflate the balloon when the guest is facing memory pressure


=== Status ===
=== Status ===
FIXME: add luiz tree.

Revision as of 21:42, 11 December 2012

Auto-ballooning

When a kvm host is running out of memory, the host kernel will take action to reclaim memory. This action may be detrimental to kvm guests performace (eg. swapping) or even extreme to the point where the kernel kills user-space processes (which could be a kvm guest itself or a virt stack component).

To help avoiding those scenarios, the hypervisor (eg. QEMU) could automatically inflate the guest's balloon (thus returning memory to the host). This will also require a method for automatically deflating the guest's memory, so that fairness is ensured and the guest kernel doesn't run itself into trouble.

The goal of this page is to collect ideas on how to implement auto-ballooning. Currently, there is only one proposal, which is the "automatic balance" idea, mostly designed by Rik van Riel.

Automatic balance

In automatic balance, the hypervisor (eg. QEMU) automatically inflates the guest balloon when the host kernel is under memory pressure. On the other hand, when the guest kernel is under memory pressure, it will automatically try to deflate its balloon (which possibly may have been inflated by the hypervisor).

It's expected that inflate and deflate will automatically balance each other over time.

Next sections describe the implementation details of this idea.

auto-inflate

There are three components needed to make auto-inflate work.

  • A host kernel API to let user-space processes know when the kernel is facing memory pressure (TODO: point to mempressure API)
  • QEMU changes to use the host kernel API, and to inflate the guest's balloon when the host kernel is facing memory pressure

auto-deflate

Only one component is needed for auto-deflate:

  • The guest virtio-balloon driver must be changed to automatically deflate the balloon when the guest is facing memory pressure

Status

FIXME: add luiz tree.