aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kvm_host.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-05-10 06:08:26 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 03:47:06 -0400
commit0719837c0832a7b305e42327caa7d330462360ea (patch)
tree73f574529aa588d5270da0a9cf048a65e863ba93 /include/linux/kvm_host.h
parenta8eeb04a44dd6dc4c8158953d9bae48849c9a188 (diff)
KVM: Reduce atomic operations on vcpu->requests
Usually the vcpu->requests bitmap is sparse, so a test_and_clear_bit() for each request generates a large number of unneeded atomics if a bit is set. Replace with a separate test/clear sequence. This is safe since there is no clear_bit() outside the vcpu thread. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r--include/linux/kvm_host.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index c8a9d628898e..e820eb579108 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -636,7 +636,12 @@ static inline bool kvm_make_check_request(int req, struct kvm_vcpu *vcpu)
636 636
637static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) 637static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
638{ 638{
639 return test_and_clear_bit(req, &vcpu->requests); 639 if (test_bit(req, &vcpu->requests)) {
640 clear_bit(req, &vcpu->requests);
641 return true;
642 } else {
643 return false;
644 }
640} 645}
641 646
642#endif 647#endif