vmm: memory: Add prefault option when creating region

When CoW can be used, the VM restoration time is reduced, but the pages
are not populated. This can lead to some slowness from the guest when
accessing these pages.

Depending on the use case, we might prefer a slower boot time for better
performances from guest runtime. The way to achieve this is to prefault
the pages in this case, using the MAP_POPULATE flag along with CoW.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-04-07 13:33:18 +02:00
parent b2cdee80b6
commit 6712958f23
2 changed files with 20 additions and 7 deletions

View File

@@ -360,9 +360,13 @@ impl Vm {
vmm_path: PathBuf,
) -> Result<Self> {
let (kvm, fd) = Vm::kvm_new()?;
let memory_manager =
MemoryManager::new(fd.clone(), &config.lock().unwrap().memory.clone(), None)
.map_err(Error::MemoryManager)?;
let memory_manager = MemoryManager::new(
fd.clone(),
&config.lock().unwrap().memory.clone(),
None,
false,
)
.map_err(Error::MemoryManager)?;
Vm::new_from_memory_manager(
config,