From patchwork Fri Sep 21 12:00:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 1491541 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 7FC673FCFC for ; Fri, 21 Sep 2012 12:04:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752787Ab2IUMEK (ORCPT ); Fri, 21 Sep 2012 08:04:10 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:53513 "EHLO e23smtp01.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752542Ab2IUMED (ORCPT ); Fri, 21 Sep 2012 08:04:03 -0400 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Sep 2012 22:02:20 +1000 Received: from d23relay04.au.ibm.com (202.81.31.246) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 21 Sep 2012 22:02:19 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8LBsfeX29360264; Fri, 21 Sep 2012 21:54:41 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8LC3wHO030541; Fri, 21 Sep 2012 22:03:59 +1000 Received: from [192.168.1.3] ([9.79.201.91]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8LC3pNR030431; Fri, 21 Sep 2012 22:03:53 +1000 From: Raghavendra K T To: Peter Zijlstra , "H. Peter Anvin" , Marcelo Tosatti , Ingo Molnar , Avi Kivity , Rik van Riel Cc: Srikar , "Nikunj A. Dadhania" , KVM , Raghavendra K T , Jiannan Ouyang , chegu vinod , "Andrew M. Theurer" , LKML , Srivatsa Vaddagiri , Gleb Natapov Date: Fri, 21 Sep 2012 17:30:20 +0530 Message-Id: <20120921120019.27611.66093.sendpatchset@codeblue> In-Reply-To: <20120921115942.27611.67488.sendpatchset@codeblue> References: <20120921115942.27611.67488.sendpatchset@codeblue> Subject: [PATCH RFC 2/2] kvm: Be courteous to other VMs in overcommitted scenario in PLE handler x-cbid: 12092112-1618-0000-0000-000002855BB2 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Raghavendra K T When PLE handler fails to find a better candidate to yield_to, it goes back and does spin again. This is acceptable when we do not have overcommit. But in overcommitted scenarios (especially when we have large number of small guests), it is better to yield. Reviewed-by: Srikar Dronamraju Signed-off-by: Raghavendra K T Acked-by: Rik van Riel --- virt/kvm/kvm_main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) -- 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 8323685..713b677 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1660,6 +1660,10 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) } } } + /* In overcommitted cases, yield instead of spinning */ + if (!yielded && rq_nr_running() > 1) + schedule(); + kvm_vcpu_set_in_spin_loop(me, false); /* Ensure vcpu is not eligible during next spinloop */