History

KVM: x86: hyper-v: replace bitmap_weight() with hweight64()

kvm_hv_flush_tlb() applies bitmap API to a u64 variable valid_bank_mask. Since valid_bank_mask has a fixed size, we can use hweight64() and avoid excessive bloating.

Yury Norov committed 4 years ago

Commit d603fd81 parent a7ef9b41 file · +2 −2Browse files

Unified · Split

arch/x86/kvm/hyperv.c+2−2
@@ -1879,7 +1879,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc) · 1878 unmodified lines
18791879 all_cpus = flush_ex.hv_vp_set.format !=
18801880 HV_GENERIC_SET_SPARSE_4K;
18811881
1882− if (hc->var_cnt != bitmap_weight((unsigned long *)&valid_bank_mask, 64))
1882+ if (hc->var_cnt != hweight64(valid_bank_mask))
18831883 return HV_STATUS_INVALID_HYPERCALL_INPUT;
18841884
18851885 if (all_cpus)
@@ -1980,7 +1980,7 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc) · 94 unmodified lines
19801980 valid_bank_mask = send_ipi_ex.vp_set.valid_bank_mask;
19811981 all_cpus = send_ipi_ex.vp_set.format == HV_GENERIC_SET_ALL;
19821982
1983− if (hc->var_cnt != bitmap_weight((unsigned long *)&valid_bank_mask, 64))
1983+ if (hc->var_cnt != hweight64(valid_bank_mask))
19841984 return HV_STATUS_INVALID_HYPERCALL_INPUT;
19851985
19861986 if (all_cpus)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t