vmm: store CPU affinity lists as slices

Each affinity host CPU list is copied from configuration.
It is only iterated afterwards, so a boxed slice is enough.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
Philipp Schuster
2026-05-14 11:04:19 +02:00
committed by Rob Bradford
parent 74392eccae
commit 29e2319247
3 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -719,7 +719,7 @@ impl CpusConfig {
v.0.iter()
.map(|(e1, e2)| CpuAffinity {
vcpu: *e1,
host_cpus: e2.clone(),
host_cpus: e2.clone().into_boxed_slice(),
})
.collect()
});
@@ -3694,16 +3694,16 @@ mod unit_tests {
CpusConfig {
boot_vcpus: 2,
max_vcpus: 2,
affinity: Some(vec![
affinity: Some(Box::new([
CpuAffinity {
vcpu: 0,
host_cpus: vec![0, 2],
host_cpus: Box::new([0, 2]),
},
CpuAffinity {
vcpu: 1,
host_cpus: vec![1, 3],
host_cpus: Box::new([1, 3]),
}
]),
])),
..Default::default()
},
);