From patchwork Fri Mar 18 19:05:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 8623331 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 872F99F6E1 for ; Fri, 18 Mar 2016 19:07:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3F1820351 for ; Fri, 18 Mar 2016 19:07:40 +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 3280B20204 for ; Fri, 18 Mar 2016 19:07:39 +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 1agziB-0000YD-BI; Fri, 18 Mar 2016 19:05:27 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agziA-0000Xd-Oq for xen-devel@lists.xenproject.org; Fri, 18 Mar 2016 19:05:26 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id BE/E5-03301-6715CE65; Fri, 18 Mar 2016 19:05:26 +0000 X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1458327925!32051727!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42131 invoked from network); 18 Mar 2016 19:05:25 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-3.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Mar 2016 19:05:25 -0000 Received: by mail-wm0-f66.google.com with SMTP id l124so8123804wmf.2 for ; Fri, 18 Mar 2016 12:05:25 -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=4IGoEYSZR660XGLssroR7Z1Ol9pPul8arejjBrFHGjA=; b=MHjda60+/qMhYBrhzTNerUIjamH5MvtLIm9CZ8cwIuAyfMfGegICJ3GVtCKyXkJrQa gNDVYGPX4dBXybVDG2QGAutJTVoR4GC/v5MJbyxOSIho2phLEnqdtH5kBeB02qokkFMC 6eNMqfgwHXiBy892ebY1hlCgSCjz+hfOLVUD1JfR8YDVrLPCu99oJZRwYbHlbdrOSIsb v0yZSlmjFSVgl0Rbp2BT01u1jOEUUIlr9RJ7TG6krKkgGgP+SrHFNRFt6LoUDbt3ioFM sLElNfUgAiBkaCm7BVmb9HuXwe6K946R4rMn9hF44sedqFI9kexbfby3fq+7K38ZPAs6 ZKqw== 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=4IGoEYSZR660XGLssroR7Z1Ol9pPul8arejjBrFHGjA=; b=bzJExvB1uozD4kkCz3n9se9zIokxrPXFX3bFysO7YUue0in+SnmkizQYkSLU0/5GQh wDkMhxAtMl6F6PpURFlq3ubQCPjyDWSkdXKOODSA3pF7Z0FUJVUVMLn5DbzW/pxW/FBd LMwGKqKiBED8C96pnoYtftv8yBUdzgbK/au23E+/0Z1c0RXrBm7YUvBvbIKpMRPTgK+e 64jjBY2v8wvqUmH+FZe8m8/3PCkrFfs6GtRDyCQFVLBMykdZA/GoEPVxYhC8SJHvBypa y1e8JzT4V5Ju7+opq0wOU3msXx6uYDyNL6cbdJxF5FoVbOmWITrlWj6idzT441uA9V5C vllQ== X-Gm-Message-State: AD7BkJLlSEJHvOZxVOGzEGaOuEDrJ2rq19a6gpxdnYOdqkxluJR6ceNLXXc3nBoYYkkefw== X-Received: by 10.194.103.5 with SMTP id fs5mr17814628wjb.42.1458327925310; Fri, 18 Mar 2016 12:05:25 -0700 (PDT) Received: from Solace.station (net-2-35-170-8.cust.vodafonedsl.it. [2.35.170.8]) by smtp.gmail.com with ESMTPSA id u16sm582706wmd.5.2016.03.18.12.05.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Mar 2016 12:05:24 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 18 Mar 2016 20:05:21 +0100 Message-ID: <20160318190521.8117.21983.stgit@Solace.station> In-Reply-To: <20160318185524.8117.74837.stgit@Solace.station> References: <20160318185524.8117.74837.stgit@Solace.station> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Tianyang Chen Subject: [Xen-devel] [PATCH 11/16] 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: George Dunlap Cc: Tianyang Chen --- 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 2fd4175..4ff26c9 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -1540,8 +1540,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