From patchwork Fri Apr 8 01:24:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8779541 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 480B9C0553 for ; Fri, 8 Apr 2016 01:25:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DF662025B for ; Fri, 8 Apr 2016 01:25:58 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 7F6782024F for ; Fri, 8 Apr 2016 01:25:57 +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 1aoL9d-0007uf-Ca; Fri, 08 Apr 2016 01:24:09 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoL9c-0007ts-5R for xen-devel@lists.xenproject.org; Fri, 08 Apr 2016 01:24:08 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 76/1D-03606-73807075; Fri, 08 Apr 2016 01:24:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDIsWRWlGSWpSXmKPExsXiVRvkpGvGwR5 u8GS2jcX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmvHqbw9jwT2uir4/Xg2Mrzm6GLk4hASmMkp0 TzzKCOKwCKxhldh85R8ziCMhcIlV4sS3YyxdjJxATozEl7dvWSHsSonLB44ygdhCAioSN7evY oIYtZhJYubz1+wgCWEBPYkjR38A2RxAdohEz0IukDCbgIHEmx17weaICChJ3Fs1GWwOs0CwxK +mFrBdLAKqEt1/54DV8ArYS/R+ug8W5xRwkJi44SnUXnuJbd0nwGxRATmJlZdboOoFJU7OfMI CspZZQFNi/S59iPHyEtvfzmGewCgyC0nVLISqWUiqFjAyr2JUL04tKkst0jXSSyrKTM8oyU3M zNE1NDDWy00tLk5MT81JTCrWS87P3cQIDP16BgbGHYynmp0PMUpyMCmJ8l55wxYuxJeUn1KZk VicEV9UmpNafIhRg4NDYMLZudOZpFjy8vNSlSR4P7KxhwsJFqWmp1akZeYAoxOmVIKDR0mE15 odKM1bXJCYW5yZDpE6xajLsWXqvbVMQmAzpMR5X4PMEAApyijNgxsBSxSXGGWlhHkZGRgYhHg KUotyM0tQ5V8xinMwKgnzyoCs4snMK4Hb9AroCCagIy7ws4EcUZKIkJJqYPQ1bZqY5ORaPun7 qXd+fzdzqTYG1T6WkXee0LLqaaTVBcO158Ls/yqfONuVHTkrf8t1ZoO4858m1phWZksfP3bTw m7OIpco9ncnLevPuOic8DDb3n6wTIAnx8HPJVNUMFWrsWKGDouUodPljgNMlg921omLTXpt+e LMuRVymT07zQsEs/m6lFiKMxINtZiLihMBiMQOVA8DAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1460078646!33585890!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57915 invoked from network); 8 Apr 2016 01:24:06 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-3.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 8 Apr 2016 01:24:06 -0000 Received: by mail-wm0-f66.google.com with SMTP id n3so760862wmn.1 for ; Thu, 07 Apr 2016 18:24:06 -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=lgQdQoiRxNvgASPHP7m5pQXje1TNQNm0U+xDdehvH4U=; b=XG2VRMp4ZMdzjYT+IFRrAwGNqehJU3iymoS03ilcwMn2Qw4R9BTfOnL/Y3psKuGYmA FqW3UNxVs3Pe0xMGFz1dXOyb+cBGTxHL+F/sOGvndrFZAyVJxnGnzfXkq+l0pUI6YPyL THZKTLimI+AcnHxcXBY6FQztX4r3kyJ/FLc4U4P3DLYjrhoeIFVRWzbnk6ay+COMkKNS 7u3eQa/wqyeGVYvH6I5tkNMmW5MfZ3e/8Xst3kti6XNBR3Ex9Ou3zdqRTArhOC+atNp2 CHCVUOLt8Dk/gPI6lXsm42ZBbOit/hCSvzxtORqkMJLRb/bzWLFDft5UVUEF9s/mKN/r Hfcw== 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=lgQdQoiRxNvgASPHP7m5pQXje1TNQNm0U+xDdehvH4U=; b=APKjQwPoc0zjLjZlGQsZ6g4AVsZB8KSnSi4zMrId772qC/pFI/heEmAiitRlqv1d+5 0ewJI7zO25vO4+406aSgQ5we0V3fcOCpIkBEbFp3ErUdJbcS00pz2qPJe9Rwcrcz/X7F GPWeLRUXEB1f3CfbN0QhpMn4DkA1GLO9/k4AxZ3WVzH76BnDXay2h8TnG3M7e6Ts3Z8t Bt1naUslFWVIdG0goP6fcRTjie7Y3uTo8HLixnk1MXpOm7NxhadgkHTm7DNZr/36xhVJ SYgcMELXLCFGURicj59Nu8sctSidOITNyjjZDnBFo09PAq8YWKOXmY+QHWKVZ945PyJ6 kLgQ== X-Gm-Message-State: AD7BkJJClEajMZggd015IYyh+36TykV4HJqnvZrobbzVnVtwY0P5WzIK+sBFQmE+WSWqPA== X-Received: by 10.28.182.194 with SMTP id g185mr591584wmf.41.1460078646712; Thu, 07 Apr 2016 18:24:06 -0700 (PDT) Received: from Solace.fritz.box (net-37-116-155-252.cust.vodafonedsl.it. [37.116.155.252]) by smtp.gmail.com with ESMTPSA id gt7sm11020540wjc.1.2016.04.07.18.24.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Apr 2016 18:24:06 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 08 Apr 2016 03:24:04 +0200 Message-ID: <20160408012403.10762.63044.stgit@Solace.fritz.box> In-Reply-To: <20160408011204.10762.14241.stgit@Solace.fritz.box> References: <20160408011204.10762.14241.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Tianyang Chen , George Dunlap Subject: [Xen-devel] [PATCH v3 06/11] xen: sched: on Credit2, don't reprogram the timer if idle 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-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP as other schedulers are doing already: if the idle vcpu is picked and scheduled, there is no need to reprogram the scheduler timer to fire and invoke csched2_schedule() again in future. Tickling or external events will serve as pokes, when necessary, but until we can, we should just stay idle. Signed-off-by: Dario Faggioli Reported-by: Tianyang Chen Suggested-by: George Dunlap Acked-by: George Dunlap --- Cc: Tianyang Chen --- Changes from v1: * use George's work address (sorry again!). --- xen/common/sched_credit2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 7286e50..b207d84 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -1543,8 +1543,12 @@ csched2_runtime(const struct scheduler *ops, int cpu, struct csched2_vcpu *snext struct csched2_runqueue_data *rqd = RQD(ops, cpu); struct list_head *runq = &rqd->runq; + /* + * If we're idle, just stay so. Others (or external events) + * will poke us when necessary. + */ if ( is_idle_vcpu(snext->vcpu) ) - return CSCHED2_MAX_TIMER; + return -1; /* General algorithm: * 1) Run until snext's credit will be 0