133 lines
4.4 KiB
Groff
133 lines
4.4 KiB
Groff
.\" $NetBSD: balloon.4,v 1.4 2011/01/14 10:01:03 jruoho Exp $
|
|
.\"
|
|
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
.\" by Cherry G. Mathew <cherry@zyx.in> and
|
|
.\" Jean-Yves Migeon <jym@NetBSD.org>
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
.\"
|
|
.Dd January 14, 2011
|
|
.Dt BALLOON 4 xen
|
|
.Os
|
|
.Sh NAME
|
|
.Nm balloon
|
|
.Nd Xen hypervisor dynamic memory resize helper
|
|
.Sh SYNOPSIS
|
|
.Cd "options XEN_BALLOON"
|
|
.Sh DESCRIPTION
|
|
The Xen
|
|
.Nm
|
|
driver can be enabled to allow the Xen hypervisor to dynamically
|
|
resize the amount of RAM a
|
|
.Nx
|
|
VM is allowed to use.
|
|
This allows the hypervisor to manage RAM more
|
|
efficiently, similar in spirit to how the
|
|
.Nx
|
|
kernel would manage RAM wrt processes, with
|
|
.Xr uvm 9 .
|
|
.Pp
|
|
The
|
|
.Nm
|
|
driver negotiates domain VM memory allocation change requests from
|
|
the Xen hypervisor, by reserving "pinned" memory for itself from the
|
|
.Nx
|
|
.Xr uvm 9
|
|
subsystem.
|
|
.Pp
|
|
There are two methods to notify the
|
|
.Nm
|
|
driver of memory allocation change requests.
|
|
.Bl -tag -width "Xr sysctl 3" -offset indent
|
|
.It Xr xenbus 4
|
|
In the xenbus method, the change notification originates outside the
|
|
VM, presumable from the Hypervisor, and is communicated over the
|
|
xenbus interface.
|
|
.It Xr sysctl 3
|
|
In the
|
|
.Xr sysctl 3
|
|
method, the change notification originates from within the VM.
|
|
Two
|
|
.Xr sysctl 7
|
|
nodes are provided:
|
|
.Bl -ohang -width kern.xen.balloon.current
|
|
.It Va kern.xen.balloon.current
|
|
This node is read-only and returns the number of memory pages
|
|
currently allocated to the VM.
|
|
.It Va kern.xen.balloon.target
|
|
This node can be written to, and sets a new target memory reservation,
|
|
in pages.
|
|
Note that targets set this way from within the VM do not
|
|
reflect in the hypervisor.
|
|
This is therefore a less preferred way to use the
|
|
.Nm
|
|
.El
|
|
.El
|
|
.Pp
|
|
In either case, once a new allocation target is set, the balloon
|
|
driver thread asynchronously attempts to reach this target in discrete
|
|
steps.
|
|
Every step, if it fails, is tried more than once.
|
|
When the target is reached, the thread goes back to sleep, waiting
|
|
for a new incoming target.
|
|
If it is not reached, the target is updated to
|
|
reflect the value after the last successful step.
|
|
.Sh EXAMPLES
|
|
.Bd -literal
|
|
# # Have a look at the current reservations.
|
|
# sysctl -a|grep balloon
|
|
kern.xen.balloon.current = 32512
|
|
kern.xen.balloon.target = 32512
|
|
#
|
|
# # Change the current target to 30000 kernel pages.
|
|
# sysctl -w kern.xen.balloon.target=30000
|
|
kern.xen.balloon.target: 32512 -\*[Gt] 30000
|
|
#
|
|
.Ed
|
|
.Sh SEE ALSO
|
|
.Xr uvm 9
|
|
.Rs
|
|
.%A Carl A. Waldspurger
|
|
.%T "Memory Resource Management in VMware ESX Server"
|
|
.%I USENIX Association
|
|
.%B Proceedings of the 5th Symposium on \
|
|
Operating Systems Design and Implementation
|
|
.%D December 9-11, 2002
|
|
.%U http://www.usenix.org/events/osdi02/tech/full_papers/waldspurger/waldspurger.pdf
|
|
.Re
|
|
.\"
|
|
.Sh AUTHORS
|
|
.An Cherry G. Mathew Aq cherry@zyx.in
|
|
.An Jean-Yves Migeon Aq jym@NetBSD.org
|
|
.Sh CAVEATS
|
|
VMs can be inadvertently
|
|
.No crashed/ Ns Fn panic Ns ed
|
|
by over expanding the
|
|
balloon allocation, creating extreme OS memory pressure.
|
|
.Sh BUGS
|
|
.Fn xenmem_get_maxreservation
|
|
is currently hard-coded to return nkmempages.
|
|
This driver is still regarded as EXPERIMENTAL.
|