From patchwork Sun Jun 20 16:21:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 107056 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5KGMET1031805 for ; Sun, 20 Jun 2010 16:22:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101Ab0FTQWE (ORCPT ); Sun, 20 Jun 2010 12:22:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61521 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168Ab0FTQWA (ORCPT ); Sun, 20 Jun 2010 12:22:00 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5KGM0PO018400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 20 Jun 2010 12:22:00 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5KGLx28028063 for ; Sun, 20 Jun 2010 12:21:59 -0400 Received: from file.tlv.redhat.com (file.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id F0187250ADD; Sun, 20 Jun 2010 19:21:58 +0300 (IDT) From: Avi Kivity To: Marcelo Tosatti Cc: kvm@vger.kernel.org Subject: [PATCH 4/4] KVM: Reduce atomic operations on vcpu->requests Date: Sun, 20 Jun 2010 19:21:58 +0300 Message-Id: <1277050918-12744-5-git-send-email-avi@redhat.com> In-Reply-To: <1277050918-12744-1-git-send-email-avi@redhat.com> References: <1277050918-12744-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 20 Jun 2010 16:22:15 +0000 (UTC) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index e706c1e..e478f3f 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -642,7 +642,12 @@ static inline bool kvm_make_check_request(int req, struct kvm_vcpu *vcpu) static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) { - return test_and_clear_bit(req, &vcpu->requests); + if (test_bit(req, &vcpu->requests)) { + clear_bit(req, &vcpu->requests); + return true; + } else { + return false; + } } #endif