hypervisor: kvm: Use unstable_sort() to keep clippy happy

"Using a stable sort consumes more memory and cpu cycles. Because values
which compare equal are identical, preserving their relative order (the
guarantee that a stable sort provides) means nothing, while the extra
costs still apply."

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-10-08 15:33:26 +01:00 committed by Sebastien Boeuf
parent bb5b9584d2
commit 573a5c63cf

View File

@ -1029,7 +1029,7 @@ impl cpu::Vcpu for KvmVcpu {
// we can calculate the id based on the offset in the structure.
reg_list.retain(|regid| *regid != 0);
reg_list.as_slice().to_vec().sort();
reg_list.as_slice().to_vec().sort_unstable();
reg_list.retain(|regid| is_system_register(*regid));