Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757083Ab2JaRLa (ORCPT ); Wed, 31 Oct 2012 13:11:30 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:35769 "EHLO e28smtp02.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753539Ab2JaRL0 (ORCPT ); Wed, 31 Oct 2012 13:11:26 -0400 Message-ID: <50915A91.1040001@linux.vnet.ibm.com> Date: Wed, 31 Oct 2012 22:36:25 +0530 From: Raghavendra K T Organization: IBM User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 MIME-Version: 1.0 To: Avi Kivity CC: Peter Zijlstra , "H. Peter Anvin" , Marcelo Tosatti , Ingo Molnar , Rik van Riel , Srikar , "Nikunj A. Dadhania" , KVM , Jiannan Ouyang , Chegu Vinod , "Andrew M. Theurer" , LKML , Srivatsa Vaddagiri , Gleb Natapov , Andrew Jones Subject: Re: [PATCH V2 RFC 2/3] kvm: Handle yield_to failure return code for potential undercommit case References: <20121029140621.15448.92083.sendpatchset@codeblue> <20121029140702.15448.56932.sendpatchset@codeblue> <50911BC3.6080305@redhat.com> <50911C7D.5080307@linux.vnet.ibm.com> <50912463.3040201@linux.vnet.ibm.com> <50912A72.6050307@redhat.com> In-Reply-To: <50912A72.6050307@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit x-cbid: 12103117-5816-0000-0000-000005253B34 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2160 Lines: 57 On 10/31/2012 07:11 PM, Avi Kivity wrote: > On 10/31/2012 03:15 PM, Raghavendra K T wrote: >> On 10/31/2012 06:11 PM, Raghavendra K T wrote: >>> On 10/31/2012 06:08 PM, Avi Kivity wrote: >>>> On 10/29/2012 04:07 PM, Raghavendra K T wrote: >>>>> From: Raghavendra K T >>>>> >>>>> Also we do not update last boosted vcpu in failure cases. >>>>> >>>>> #endif >>>>> + >>>>> void kvm_vcpu_on_spin(struct kvm_vcpu *me) >>>>> { >>>>> struct kvm *kvm = me->kvm; >>>>> @@ -1727,11 +1727,12 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) >>>>> continue; >>>>> if (!kvm_vcpu_eligible_for_directed_yield(vcpu)) >>>>> continue; >>>>> - if (kvm_vcpu_yield_to(vcpu)) { >>>>> + >>>>> + yielded = kvm_vcpu_yield_to(vcpu); >>>>> + if (yielded > 0) >>>>> kvm->last_boosted_vcpu = i; >>>>> - yielded = 1; >>>>> + if (yielded) >>>>> break; >>>>> - } >>>>> } >>>> >>>> If yielded == -ESRCH, should we not try to yield to another vcpu? >>>> >>> >>> Yes. plan is to abort the iteration. since it means we are mostly >>> undercommitted. >> >> Sorry if it was ambiguous. I wanted to say we do not want to continue >> yield to another vcpu.. >> > > > Why not? We found that this particular vcpu is running and therefore > likely not a lock holder. That says nothing about other vcpus. The > next in line might be runnable-but-not-running on another runqueue. Agree that next in the line might be runnable-not-running. But here we are optimistic that, that is not the case and we save time by returning back instead of iterating, thinking we are mostly in undercommitted case and each vcpu has dedicated cpu. Probably an alternative we have here is to look for say 2-3 successive failures before breaking out? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/