mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-13 21:09:31 +00:00
runtime-rs: Add reclaim_guest_freed_memory cloud-hypervisor support
Add reclaim_guest_freed_memory config to cloud-hypervisor in runtime-rs. Fixes: #10710 Signed-off-by: Hui Zhu <teawater@antgroup.com>
This commit is contained in:
@@ -158,6 +158,16 @@ virtio_fs_cache = "@DEFVIRTIOFSCACHE@"
|
|||||||
# > 5 --> will be set to 5
|
# > 5 --> will be set to 5
|
||||||
default_bridges = @DEFBRIDGES@
|
default_bridges = @DEFBRIDGES@
|
||||||
|
|
||||||
|
# Reclaim guest freed memory.
|
||||||
|
# Enabling this will result in the VM balloon device having f_reporting=on set.
|
||||||
|
# Then the hypervisor will use it to reclaim guest freed memory.
|
||||||
|
# This is useful for reducing the amount of memory used by a VM.
|
||||||
|
# Enabling this feature may sometimes reduce the speed of memory access in
|
||||||
|
# the VM.
|
||||||
|
#
|
||||||
|
# Default false
|
||||||
|
#reclaim_guest_freed_memory = true
|
||||||
|
|
||||||
# Block storage driver to be used for the hypervisor in case the container
|
# Block storage driver to be used for the hypervisor in case the container
|
||||||
# rootfs is backed by a block device.
|
# rootfs is backed by a block device.
|
||||||
block_device_driver = "virtio-blk-pci"
|
block_device_driver = "virtio-blk-pci"
|
||||||
|
@@ -180,6 +180,15 @@ impl TryFrom<NamedHypervisorConfig> for VmConfig {
|
|||||||
|
|
||||||
let platform = get_platform_cfg(guest_protection_to_use);
|
let platform = get_platform_cfg(guest_protection_to_use);
|
||||||
|
|
||||||
|
let balloon = if cfg.device_info.reclaim_guest_freed_memory {
|
||||||
|
Some(crate::BalloonConfig {
|
||||||
|
free_page_reporting: true,
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let cfg = VmConfig {
|
let cfg = VmConfig {
|
||||||
cpus,
|
cpus,
|
||||||
memory,
|
memory,
|
||||||
@@ -193,6 +202,7 @@ impl TryFrom<NamedHypervisorConfig> for VmConfig {
|
|||||||
vsock: Some(vsock),
|
vsock: Some(vsock),
|
||||||
rng,
|
rng,
|
||||||
platform,
|
platform,
|
||||||
|
balloon,
|
||||||
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user