diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c6c0728a4fcc8d9a6684eba25c976b055553306e..a71c4846715e75396b781425c1ca9d05e5c85158 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -595,22 +595,28 @@
<memoryBacking>
<hugepages/>
<nosharepages/>
+ <locked/>
</memoryBacking>
...
</domain>
+
The optional memoryBacking
element may contain several
+ elements that influence how virtual memory pages are backed by host
+ pages.
+
- memoryBacking
- - The optional
memoryBacking
element has two
- optional elements. The element hugepages
tells
- the hypervisor that the guest should have its memory allocated
- using hugepages instead of the normal native page size. And the
- optional element nosharepages
- (since 1.0.6) tells the hypervisor
- that share pages (memory merge, KSM) should be disabled on guest
- startup.
-
+ hugepages
+ - This tells the hypervisor that the guest should have its memory
+ allocated using hugepages instead of the normal native page size.
+ nosharepages
+ - Instructs hypervisor to disable shared pages (memory merge, KSM) for
+ this domain. Since 1.0.6
+ locked
+ - When set and supported by the hypervisor, memory pages belonging
+ to the domain will be locked in host's memory and the host will not
+ be allowed to swap them out.
+ Since 1.0.6
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 8c7c1bcf016bc7bb4d6b0b346ffa5bb06aee02bd..018ca0b6beb99f674eff4270ea7d08b9cb134a0a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -501,6 +501,11 @@
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 11978dbe2e6efcfa40d540b5dcc53a5dc897a69c..b5e5d4d050d84e6393fb98f3bcf01cd44e43b6ac 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10411,6 +10411,9 @@ virDomainDefParseXML(xmlDocPtr xml,
if ((node = virXPathNode("./memoryBacking/nosharepages", ctxt)))
def->mem.nosharepages = true;
+ if (virXPathBoolean("boolean(./memoryBacking/locked)", ctxt))
+ def->mem.locked = true;
+
/* Extract blkio cgroup tunables */
if (virXPathUInt("string(./blkiotune/weight)", ctxt,
&def->blkio.weight) < 0)
@@ -15766,17 +15769,16 @@ virDomainDefFormatInternal(virDomainDefPtr def,
def->mem.swap_hard_limit)
virBufferAddLit(buf, " \n");
- if (def->mem.hugepage_backed || def->mem.nosharepages)
+ if (def->mem.hugepage_backed || def->mem.nosharepages || def->mem.locked) {
virBufferAddLit(buf, " \n");
-
- if (def->mem.hugepage_backed)
- virBufferAddLit(buf, " \n");
-
- if (def->mem.nosharepages)
- virBufferAddLit(buf, " \n");
-
- if (def->mem.hugepage_backed || def->mem.nosharepages)
+ if (def->mem.hugepage_backed)
+ virBufferAddLit(buf, " \n");
+ if (def->mem.nosharepages)
+ virBufferAddLit(buf, " \n");
+ if (def->mem.locked)
+ virBufferAddLit(buf, " \n");
virBufferAddLit(buf, " \n");
+ }
virBufferAddLit(buf, "