When a low memory threshold on the Xen heap is reached, we fire a
global dom0 virq. If someone's listening, they can free up some more
memory.
The low threshold is configurable via the command line token
'low_mem_virq_limit", and defaults to 64MiB. If the user specifies
zero via the command line, the virq is disabled.
We define a new virq VIRQ_ENOMEM. Potential listeners include
squeezed, xenballoond, or anything else that can be fired through
xencommons.
We error-check the low mem virq against initial available heap (after
dom0 allocation), to avoid firing immediately.
Virq issuing is controlled by a hysteresis algorithm: when memory dips
below a threshold, the virq is issued and the next virq will fire when
memory shrinks another order of magnitude. The virq will not fire
again in the current "band" until memory grows over the next higher
order of magnitude.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Committed-by: Keir Fraser <keir@xen.org>