diff --git a/src/libs/kata-types/src/config/hypervisor/mod.rs b/src/libs/kata-types/src/config/hypervisor/mod.rs index ab0a38aaa4..ed9312f93f 100644 --- a/src/libs/kata-types/src/config/hypervisor/mod.rs +++ b/src/libs/kata-types/src/config/hypervisor/mod.rs @@ -499,7 +499,7 @@ pub struct DeviceInfo { /// /// Enabling this will result in the VM balloon device having f_reporting=on set #[serde(default)] - pub enable_balloon_f_reporting: bool, + pub reclaim_guest_freed_memory: bool, } impl DeviceInfo { diff --git a/src/runtime-rs/config/configuration-dragonball.toml.in b/src/runtime-rs/config/configuration-dragonball.toml.in index 07c943e711..e2dc7ae856 100644 --- a/src/runtime-rs/config/configuration-dragonball.toml.in +++ b/src/runtime-rs/config/configuration-dragonball.toml.in @@ -98,11 +98,15 @@ default_maxvcpus = @DEFMAXVCPUS_DB@ # > 5 --> will be set to 5 default_bridges = @DEFBRIDGES@ -# Enable balloon f_reporting -# Enabling this will result in the VM balloon device having f_reporting=on set +# 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 -#enable_balloon_f_reporting = true +#reclaim_guest_freed_memory = true # Default memory size in MiB for SB/VM. # If unspecified then it will be set @DEFMEMSZ@ MiB. diff --git a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs index 57613813dd..92637e2bc4 100644 --- a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs +++ b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs @@ -430,7 +430,7 @@ impl DragonballInner { use_shared_irq: None, use_generic_irq: None, f_deflate_on_oom: false, - f_reporting: self.config.device_info.enable_balloon_f_reporting, + f_reporting: self.config.device_info.reclaim_guest_freed_memory, }; self.vmm_instance .insert_balloon_device(balloon_config) @@ -462,7 +462,7 @@ impl DragonballInner { use_shared_irq: None, use_generic_irq: None, f_deflate_on_oom: false, - f_reporting: self.config.device_info.enable_balloon_f_reporting, + f_reporting: self.config.device_info.reclaim_guest_freed_memory, }; self.balloon_size = had_mem_mb - new_mem_mb; self.vmm_instance diff --git a/src/runtime-rs/crates/hypervisor/src/dragonball/mod.rs b/src/runtime-rs/crates/hypervisor/src/dragonball/mod.rs index 9b0a238242..4b85420ad2 100644 --- a/src/runtime-rs/crates/hypervisor/src/dragonball/mod.rs +++ b/src/runtime-rs/crates/hypervisor/src/dragonball/mod.rs @@ -85,7 +85,7 @@ impl Hypervisor for Dragonball { let mut inner = self.inner.write().await; let ret = inner.start_vm(timeout).await; - if ret.is_ok() && inner.config.device_info.enable_balloon_f_reporting { + if ret.is_ok() && inner.config.device_info.reclaim_guest_freed_memory { // The virtio-balloon device must be inserted into dragonball and // recognized by the guest kernel only after the dragonball upcall is ready. // The dragonball upcall is not ready immediately after the VM starts,