From patchwork Mon Mar 4 18:02:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 2213661 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 52D183FCF2 for ; Mon, 4 Mar 2013 18:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932211Ab3CDSF4 (ORCPT ); Mon, 4 Mar 2013 13:05:56 -0500 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:38215 "EHLO e28smtp03.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932132Ab3CDSFy (ORCPT ); Mon, 4 Mar 2013 13:05:54 -0500 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Mar 2013 23:33:05 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 4 Mar 2013 23:33:01 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 8F2F73940053; Mon, 4 Mar 2013 23:35:46 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r24I5hW230146722; Mon, 4 Mar 2013 23:35:44 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r24I5ijC002618; Tue, 5 Mar 2013 05:05:45 +1100 Received: from codeblue.in.ibm.com ([9.124.212.72]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r24I5eDa002388; Tue, 5 Mar 2013 05:05:41 +1100 From: Raghavendra K T To: Peter Zijlstra , Avi Kivity , Gleb Natapov , Ingo Molnar , Marcelo Tosatti , Rik van Riel Cc: Srikar , "H. Peter Anvin" , "Nikunj A. Dadhania" , KVM , Raghavendra K T , Thomas Gleixner , Jiannan Ouyang , Chegu Vinod , "Andrew M. Theurer" , LKML , Srivatsa Vaddagiri , Andrew Jones Date: Mon, 04 Mar 2013 23:32:27 +0530 Message-Id: <20130304180227.31281.96284.sendpatchset@codeblue.in.ibm.com> In-Reply-To: <20130304180146.31281.33540.sendpatchset@codeblue.in.ibm.com> References: <20130304180146.31281.33540.sendpatchset@codeblue.in.ibm.com> Subject: [PATCH RFC 2/2] kvm: Iterate over only vcpus that are preempted X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13030418-3864-0000-0000-000007157B3E Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Raghavendra K T This helps in filtering out the eligible candidates further and thus potentially helps in quickly allowing preempted lockholders to run. Note that if a vcpu was spinning during preemption we filter them by checking whether they are preempted due to pause loop exit. Signed-off-by: Raghavendra K T Reviewed-by: Chegu Vinod --- virt/kvm/kvm_main.c | 2 ++ 1 file changed, 2 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 83a804c..60114e1 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1790,6 +1790,8 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) continue; } else if (pass && i > last_boosted_vcpu) break; + if (!ACCESS_ONCE(vcpu->preempted)) + continue; if (vcpu == me) continue; if (waitqueue_active(&vcpu->wq))