Do a single atomic OR using the atomic overlay of reprogram_pmi bitmask, instead of one atomic set_bit() call per counter. Signed-off-by: Yosry Ahmed --- arch/x86/kvm/pmu.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h index f8286067722b0..0e99022168a85 100644 --- a/arch/x86/kvm/pmu.h +++ b/arch/x86/kvm/pmu.h @@ -213,13 +213,10 @@ static inline void kvm_pmu_request_counter_reprogram(struct kvm_pmc *pmc) static inline void kvm_pmu_request_counters_reprogram(struct kvm_pmu *pmu, u64 counters) { - int bit; - if (!counters) return; - for_each_set_bit(bit, (unsigned long *)&counters, X86_PMC_IDX_MAX) - set_bit(bit, pmu->reprogram_pmi); + atomic64_or(counters, &pmu->__reprogram_pmi); kvm_make_request(KVM_REQ_PMU, pmu_to_vcpu(pmu)); } -- 2.54.0.794.g4f17f83d09-goog