mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-02 11:35:46 +00:00
vmm: cpu: Avoid useless cloning of Arc<Mutex<Vcpu>>
Since the object returned from CpuManager.create_vcpu() is never used, we can avoid the cloning of this object. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
9aab70ec1a
commit
a3dfe726f8
@ -648,7 +648,7 @@ impl CpuManager {
|
|||||||
cpu_id: u8,
|
cpu_id: u8,
|
||||||
entry_point: Option<EntryPoint>,
|
entry_point: Option<EntryPoint>,
|
||||||
snapshot: Option<Snapshot>,
|
snapshot: Option<Snapshot>,
|
||||||
) -> Result<Arc<Mutex<Vcpu>>> {
|
) -> Result<()> {
|
||||||
info!("Creating vCPU: cpu_id = {}", cpu_id);
|
info!("Creating vCPU: cpu_id = {}", cpu_id);
|
||||||
|
|
||||||
let mut vcpu = Vcpu::new(cpu_id, &self.vm, Some(self.vmmops.clone()))?;
|
let mut vcpu = Vcpu::new(cpu_id, &self.vm, Some(self.vmmops.clone()))?;
|
||||||
@ -676,9 +676,9 @@ impl CpuManager {
|
|||||||
|
|
||||||
// Adding vCPU to the CpuManager's vCPU list.
|
// Adding vCPU to the CpuManager's vCPU list.
|
||||||
let vcpu = Arc::new(Mutex::new(vcpu));
|
let vcpu = Arc::new(Mutex::new(vcpu));
|
||||||
self.vcpus.push(Arc::clone(&vcpu));
|
self.vcpus.push(vcpu);
|
||||||
|
|
||||||
Ok(vcpu)
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Only create new vCPUs if there aren't any inactive ones to reuse
|
/// Only create new vCPUs if there aren't any inactive ones to reuse
|
||||||
|
Loading…
Reference in New Issue
Block a user