From patchwork Fri Sep 30 02:53:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9357461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A3D26077A for ; Fri, 30 Sep 2016 02:56:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FA4B29D3E for ; Fri, 30 Sep 2016 02:56:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13D8F29D44; Fri, 30 Sep 2016 02:56:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E731829D40 for ; Fri, 30 Sep 2016 02:56:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpnxB-0001oA-1z; Fri, 30 Sep 2016 02:53:37 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpnxA-0001o4-3N for xen-devel@lists.xenproject.org; Fri, 30 Sep 2016 02:53:36 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 6C/EF-28813-FA3DDE75; Fri, 30 Sep 2016 02:53:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRWlGSWpSXmKPExsXiVRvkorvu8tt wg8UdGhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bOs0eZCubwVjRs+cDYwLiTq4uRi0NIYAaj xIuVa5hAHBaBNawSm771gTkSApdYJdZ0tLN0MXICOTESZ5c8AbI5gOwqiZsvFUHCQgIqEje3r 2KCmPSLUeLt/6fsIAlhAT2JI0d/QNkxEvf+LgCbwyZgIPFmx15WEFtEQEni3qrJTCA2s0CUxJ nlzcwgNouAqsSry8fB4rwC3hKbN5wHi3MK+Er82vaCBWKxj8Tv5cvZQGxRATmJlZdbWCHqBSV OzoS4k1lAU2L9Ln2I8fIS29/OYZ7AKDILSdUshKpZSKoWMDKvYtQoTi0qSy3SNTTSSyrKTM8o yU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDH8GINjB+Krb+RCjJAeTkiiv7NG34UJ8Sfkpl RmJxRnxRaU5qcWHGDU4OAQmnJ07nUmKJS8/L1VJgtf1ElCdYFFqempFWmYOMEJhSiU4eJREeE 9cAErzFhck5hZnpkOkTjHqcmyZem8tkxDYDClxXhaQGQIgRRmleXAjYMniEqOslDAvI9CBQjw FqUW5mSWo8q8YxTkYlYR5bUCm8GTmlcBtegV0BBPQEflH34AcUZKIkJJqYKzsYSy4VFDb0tn6 s5tjhpyeeJFYqMxMuQ9huyOCbyzQDYn70jajYd2vOd3Lf350en9NO3/V1kU7pky8leXJpso5p /DwEs+5V35vtzx4TfaX+77PCX3v+h7cl88qzlFgP+r9Z1fAS/uInsuBrLd2PF757V7KF8mmM7 zpwWs+i15ZuPioeUcxxxQlluKMREMt5qLiRAAGcqXHEQMAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1475204014!63670865!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18136 invoked from network); 30 Sep 2016 02:53:34 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 30 Sep 2016 02:53:34 -0000 Received: by mail-wm0-f68.google.com with SMTP id b184so1384191wma.3 for ; Thu, 29 Sep 2016 19:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=SEUr5WVyHprS5MubcEId7JA8j/C2bgAlWVDHy2c9RpU=; b=sTOTDM0ZKHbaL2h4fGIr7Y3r2LSwoz2bBNw3jEfPrQeUsU9UAPUuH4LhjhryFBiNZ2 I+UhR9pFJ9HjyZU5naHRwPvSbmwUqQQ+GeFT3plgUmPEni4MFxo20fD92kt5zRvrx8ba LxNYbO5S5dSRfffwl2loHDLosXO/UKtdIYaJMLvjn8vVojLRLV4kV2AC9dpbeWazviR6 2+C41VWefSaxYYGiLOglV3cVvPIZd2nsP+4QrbNHHfwtSLkDeZC18FsFPWwM7QE5KBUl CWNknSc5p8G9ZqpID+03arHxFyWm94tYfDUYb06asLGiglX7ZfiLYFKpd9uI9+RNWeCu q0Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=SEUr5WVyHprS5MubcEId7JA8j/C2bgAlWVDHy2c9RpU=; b=J0ccxfyFIkTjnbhb5cyiiemtahjvWU6QMSHBCzgBJD9/60t5W2MCcK+ah9e1TxYHQ/ vwW8XxprLkpR6/lwNCp2rxBNDFmTmBwL3qEO6Tpg8VvuU65FLNKdKE2RYfpQL+mZVtX1 gI3GEVP53pgE3xTYuDnQOnlAyFSls+Cg+29mGhGB76ouhq2G/9C7hw8i0woi1amE6r/N Xlxnn8XW2RTMea18f9WNVeHqdU7h9MOgiIrZsyzqp3rtJ1+hI+BeVeLyFTOohT5ncDF6 rhZjgJdVNV/6rdbNg9I/kOdCWFU40+vX9U9czEi+CXMAOv2yJJzrV4qhh8Otahh5r28J 45ag== X-Gm-Message-State: AA6/9RnNBveVb3xiuJO5CXj3earDWVvOjsO2rJlhB1C+uyXQ+Z5Z7xY786GHjS4s4fBfMA== X-Received: by 10.194.184.39 with SMTP id er7mr3970925wjc.159.1475204014227; Thu, 29 Sep 2016 19:53:34 -0700 (PDT) Received: from Solace.fritz.box ([80.66.223.126]) by smtp.gmail.com with ESMTPSA id x133sm1717973wme.8.2016.09.29.19.53.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Sep 2016 19:53:33 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 30 Sep 2016 04:53:32 +0200 Message-ID: <147520401251.22544.7327169776043168083.stgit@Solace.fritz.box> In-Reply-To: <147520253247.22544.10673844222866363947.stgit@Solace.fritz.box> References: <147520253247.22544.10673844222866363947.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Anshul Makkar Subject: [Xen-devel] [PATCH v2 02/10] xen: credit1: don't rate limit context switches in case of yields X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Rate limiting has been primarily introduced to avoid too heavy context switch rate due to interrupts, and, in general, asynchronous events. If a vcpu "voluntarily" yields, we really should let it give up the cpu for a while. In fact, it may be that it is yielding because it's about to start spinning, and there's few point in forcing a vcpu to spin for (potentially) the entire rate-limiting period. Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap --- Cc: George Dunlap Cc: Anshul Makkar --- Changes from v1: * move this patch up in the series, and remove the Credit2 bits, as suggested during review; --- xen/common/sched_credit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 4d84b5f..5700763 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -1802,9 +1802,16 @@ csched_schedule( * cpu and steal it. */ - /* If we have schedule rate limiting enabled, check to see - * how long we've run for. */ - if ( !tasklet_work_scheduled + /* + * If we have schedule rate limiting enabled, check to see + * how long we've run for. + * + * If scurr is yielding, however, we don't let rate limiting kick in. + * In fact, it may be the case that scurr is about to spin, and there's + * no point forcing it to do so until rate limiting expires. + */ + if ( !test_bit(CSCHED_FLAG_VCPU_YIELD, &scurr->flags) + && !tasklet_work_scheduled && prv->ratelimit_us && vcpu_runnable(current) && !is_idle_vcpu(current)