Skip to content

Commit 3381c38

Browse files
bwswyadvr
authored andcommitted
CLOUDSTACK-10073: KVM host RAM overprovisioning (#2266)
Commit enables a new feature for KVM hypervisor which purpose is to increase virtually amount of RAM available beyond the actual limit. There is a new parameter in agent.properties: host.overcommit.mem.mb which enables adding specified amount of RAM to actually available. It is necessary to utilize KSM and ZSwap features which extend RAM with deduplication and compression.
1 parent a06530d commit 3381c38

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

agent/conf/agent.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,15 @@ hypervisor.type=kvm
176176
# vm.rng.rate.period=1000
177177
# The number of milliseconds in which the guest is allowed to obtain the bytes
178178
# specified above.
179-
179+
#
180180
# router.aggregation.command.each.timeout=600
181181
# timeout value for aggregation commands send to virtual router
182182
#
183-
183+
# host.overcommit.mem.mb = 0
184+
# allows to increase amount of ram available on host virtually to utilize Zswap, KSM features
185+
# and modern fast SSD/3D XPoint devices. Specified amount of MBs is added to the memory agent
186+
# reports to the Management Server
187+
# Default: 0
184188
#
185189
# vm.watchdog.model=i6300esb
186190
# The model of Watchdog timer to present to the Guest

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
304304

305305
private long _dom0MinMem;
306306

307+
private long _dom0OvercommitMem;
308+
307309
protected boolean _disconnected = true;
308310
protected int _cmdsTimeout;
309311
protected int _stopTimeout;
@@ -849,6 +851,11 @@ public boolean configure(final String name, final Map<String, Object> params) th
849851
// Reserve 1GB unless admin overrides
850852
_dom0MinMem = NumbersUtil.parseInt(value, 1024) * 1024 * 1024L;
851853

854+
value = (String)params.get("host.overcommit.mem.mb");
855+
// Support overcommit memory for host if host uses ZSWAP, KSM and other memory
856+
// compressing technologies
857+
_dom0OvercommitMem = NumbersUtil.parseInt(value, 0) * 1024 * 1024L;
858+
852859
value = (String) params.get("kvmclock.disable");
853860
if (Boolean.parseBoolean(value)) {
854861
_noKvmClock = true;
@@ -2782,12 +2789,12 @@ protected List<Object> getHostInfo() {
27822789
info.add((int)cpus);
27832790
info.add(speed);
27842791
// Report system's RAM as actual RAM minus host OS reserved RAM
2785-
ram = ram - _dom0MinMem;
2792+
ram = ram - _dom0MinMem + _dom0OvercommitMem;
27862793
info.add(ram);
27872794
info.add(cap);
27882795
info.add(_dom0MinMem);
27892796
info.add(cpuSockets);
2790-
s_logger.debug("cpus=" + cpus + ", speed=" + speed + ", ram=" + ram + ", _dom0MinMem=" + _dom0MinMem + ", cpu sockets=" + cpuSockets);
2797+
s_logger.debug("cpus=" + cpus + ", speed=" + speed + ", ram=" + ram + ", _dom0MinMem=" + _dom0MinMem + ", _dom0OvercommitMem=" + _dom0OvercommitMem + ", cpu sockets=" + cpuSockets);
27912798

27922799
return info;
27932800
}

0 commit comments

Comments
 (0)