runtime-rs: db: Change config enable_balloon_f_reporting

Change config enable_balloon_f_reporting of db to
reclaim_guest_freed_memory.

Signed-off-by: Hui Zhu <teawater@antgroup.com>
This commit is contained in:
Hui Zhu
2025-01-21 10:28:19 +08:00
parent 42f5ef9ff1
commit 8f550de88a
4 changed files with 11 additions and 7 deletions

View File

@@ -499,7 +499,7 @@ pub struct DeviceInfo {
/// ///
/// Enabling this will result in the VM balloon device having f_reporting=on set /// Enabling this will result in the VM balloon device having f_reporting=on set
#[serde(default)] #[serde(default)]
pub enable_balloon_f_reporting: bool, pub reclaim_guest_freed_memory: bool,
} }
impl DeviceInfo { impl DeviceInfo {

View File

@@ -98,11 +98,15 @@ default_maxvcpus = @DEFMAXVCPUS_DB@
# > 5 --> will be set to 5 # > 5 --> will be set to 5
default_bridges = @DEFBRIDGES@ default_bridges = @DEFBRIDGES@
# Enable balloon f_reporting # Reclaim guest freed memory.
# Enabling this will result in the VM balloon device having f_reporting=on set # 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 # Default false
#enable_balloon_f_reporting = true #reclaim_guest_freed_memory = true
# Default memory size in MiB for SB/VM. # Default memory size in MiB for SB/VM.
# If unspecified then it will be set @DEFMEMSZ@ MiB. # If unspecified then it will be set @DEFMEMSZ@ MiB.

View File

@@ -430,7 +430,7 @@ impl DragonballInner {
use_shared_irq: None, use_shared_irq: None,
use_generic_irq: None, use_generic_irq: None,
f_deflate_on_oom: false, 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 self.vmm_instance
.insert_balloon_device(balloon_config) .insert_balloon_device(balloon_config)
@@ -462,7 +462,7 @@ impl DragonballInner {
use_shared_irq: None, use_shared_irq: None,
use_generic_irq: None, use_generic_irq: None,
f_deflate_on_oom: false, 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.balloon_size = had_mem_mb - new_mem_mb;
self.vmm_instance self.vmm_instance

View File

@@ -85,7 +85,7 @@ impl Hypervisor for Dragonball {
let mut inner = self.inner.write().await; let mut inner = self.inner.write().await;
let ret = inner.start_vm(timeout).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 // The virtio-balloon device must be inserted into dragonball and
// recognized by the guest kernel only after the dragonball upcall is ready. // recognized by the guest kernel only after the dragonball upcall is ready.
// The dragonball upcall is not ready immediately after the VM starts, // The dragonball upcall is not ready immediately after the VM starts,