mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm, virtio-devices: mem: Don't use MADV_DONTNEED on hugepages
This commit introduces a new information to the VirtioMemZone structure in order to know if the memory zone is backed by hugepages. Based on this new information, the virtio-mem device is now able to determine if madvise(MADV_DONTNEED) should be performed or not. The madvise documentation specifies that MADV_DONTNEED advice will fail if the memory range has been allocated with some hugepages. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com> Signed-off-by: Hui Zhu <teawater@antfin.com>
This commit is contained in:
committed by
Rob Bradford
parent
54f814f34a
commit
c397c9c95e
@@ -72,6 +72,7 @@ pub struct VirtioMemZone {
|
||||
region: Arc<GuestRegionMmap>,
|
||||
resize_handler: virtio_devices::Resize,
|
||||
hotplugged_size: u64,
|
||||
hugepages: bool,
|
||||
}
|
||||
|
||||
impl VirtioMemZone {
|
||||
@@ -84,6 +85,9 @@ impl VirtioMemZone {
|
||||
pub fn hotplugged_size(&self) -> u64 {
|
||||
self.hotplugged_size
|
||||
}
|
||||
pub fn hugepages(&self) -> bool {
|
||||
self.hugepages
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -684,6 +688,7 @@ impl MemoryManager {
|
||||
resize_handler: virtio_devices::Resize::new()
|
||||
.map_err(Error::EventFdFail)?,
|
||||
hotplugged_size: zone.hotplugged_size.unwrap_or(0),
|
||||
hugepages: zone.hugepages,
|
||||
});
|
||||
|
||||
start_of_device_area = start_addr
|
||||
|
||||
Reference in New Issue
Block a user