From patchwork Fri Jun 17 23:11:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9185135 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 96995601C0 for ; Fri, 17 Jun 2016 23:13:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85458200E7 for ; Fri, 17 Jun 2016 23:13:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79EBE27F07; Fri, 17 Jun 2016 23:13:41 +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 0050F200E7 for ; Fri, 17 Jun 2016 23:13:40 +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 1bE2ve-0003BJ-40; Fri, 17 Jun 2016 23:11:58 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bE2vd-0003Ag-2O for xen-devel@lists.xenproject.org; Fri, 17 Jun 2016 23:11:57 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 1B/C6-11548-CB384675; Fri, 17 Jun 2016 23:11:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRWlGSWpSXmKPExsXiVRvkrLu7OSX c4M9LQ4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPOnUvsBUv4K3o38jcwdvF0MXJxCAnMYJSY vWgSG4jDIrCGVeLjjsmMII6EwCVWib+T3wE5nEBOjMTOzuvMEHalxIUfG8HiQgIqEje3r2KCG LWISeJ9SwtYkbCAnsSRoz/Yuxg5gOwIiQ+HTUHCbAIGEm927GUFsUUElCTurZoM1sss0MAoMe HxLiaQBIuAqsS1iyfYQWxeAW+J7cffgcU5BXwlVl/ZxQax2Efi4rlHYLaogJzEysstrBD1ghI nZz5hAdnLLKApsX6XPkiYWUBeYvvbOcwTGEVmIamahVA1C0nVAkbmVYzqxalFZalFukZ6SUWZ 6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBwc8ABDsYl/11OsQoycGkJMp7pTIlXIgvK T+lMiOxOCO+qDQntfgQowYHh8CEs3OnM0mx5OXnpSpJ8Bo0AdUJFqWmp1akZeYA4xOmVIKDR0 mEtwokzVtckJhbnJkOkTrFqMuxZeq9tUxCYDOkxHk1QYoEQIoySvPgRsBSxSVGWSlhXkagA4V 4ClKLcjNLUOVfMYpzMCoJ80aCTOHJzCuB2/QK6AgmoCM05yWDHFGSiJCSamCcpPDxuPvbiUXx U0rNkv4fli+WctB7vS6/dc3KdE4Z7oerw2Z83iwZ6eR7+unRjt1zXbQfxD/f+Nh/38t5B18zH /bzKO6bKr3kpfHiw2dOpH3l3h8k6eYfIRq56TNnibhR8zZvpkD5v37CK4+6T9j8q55z2WH+gk y+s+siyo9wuIu18Wqw6jcrsRRnJBpqMRcVJwIAXZdVZxADAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1466205115!19454111!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15108 invoked from network); 17 Jun 2016 23:11:55 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jun 2016 23:11:55 -0000 Received: by mail-wm0-f67.google.com with SMTP id r201so1102429wme.0 for ; Fri, 17 Jun 2016 16:11:55 -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=yiOy0d0aSBDmhsw9iUX1tdT4agIIpRNze1FGHE+3ROM=; b=q6lQ7p/ZZ2y/WFFVPe67SeubA4eLPvmzPpxsH4HsVJBbXx2QMNNZdJLQ9IHvu/0Sct y0noKbbYD6cvqnGGz1rtxLNoprPl9vVrShULo29Q0jl0a1rPv7Z3I5mpsidjyQmjdJ/j 8VywNGYhYeJFzsVoHU/DUnmpRJuH18KO2emRjicwXllG5x/liQ7M4jznCe36wX7EC2eM VQLCtvkR+9XTb2ThPkIJNURe8JXL8ibfIzsI/A/NGcUb8ON6CpweMtKRFeSyHPKl4DOv UpFBMH6rlgIs+66xnchFqPjo7Hf2yJqhG/KGkEWDI8qY27rBXk3nWCTGFn803EZpTKGd yWIg== 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=yiOy0d0aSBDmhsw9iUX1tdT4agIIpRNze1FGHE+3ROM=; b=idhp1O7EERoWnQutwZ3oguo37ZpvvxO6cabcIeZ4RR+Wfl2e6clrGNP1gH+/tlsu/w X1PSusuGPFpEBENmOTOfU7TEPDdKOdgkk8ROVXqwZOqlW8XEaGHk7WTKAgSS1MHF3xn2 A+caWGW3Rg1crMk0gPW6wmxqOPBsaTjTKCIHdR+Bol1IsdceWWbYnj/v13SRIXMRIveQ ltS8LqHyhJUrp/wJmhtuXyIOiPihPBmgiJYWxp8sqhRop3VFLzpuIgvRJhIa9DRzCnyn QdxBhcKgAn//qbxCZscVqznE6pcuAYCKMu+xm3yvpwpFfAkjLs15aOeoDL4hocPKn8lr 4iPg== X-Gm-Message-State: ALyK8tKCAJbAATravdtoGdD1BNgNaTUJzaf7zlpjET90Binl5HPtjSe2SvR9ZvAU+lE9tA== X-Received: by 10.28.153.138 with SMTP id b132mr735689wme.94.1466205115364; Fri, 17 Jun 2016 16:11:55 -0700 (PDT) Received: from Solace.fritz.box (net-93-65-149-191.cust.vodafonedsl.it. [93.65.149.191]) by smtp.gmail.com with ESMTPSA id el4sm18171027wjd.23.2016.06.17.16.11.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2016 16:11:54 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Sat, 18 Jun 2016 01:11:52 +0200 Message-ID: <146620511277.29766.6122289936385803242.stgit@Solace.fritz.box> In-Reply-To: <146620492155.29766.10321123657058307698.stgit@Solace.fritz.box> References: <146620492155.29766.10321123657058307698.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Anshul Makkar , George Dunlap , David Vrabel Subject: [Xen-devel] [PATCH 05/19] xen: credit2: do not warn if calling burn_credits more than once 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 on the same vcpu, without NOW() having changed. This is, in fact, a legitimate use case. If it happens, we should just do nothing, without producing any warning or debug message. While there, fix style and add a couple of branching hints. Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap --- Cc: George Dunlap Cc: Anshul Makkar Cc: David Vrabel --- xen/common/sched_credit2.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index ef199e3..9e8e561 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -738,14 +738,15 @@ static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now, /* No need to resort runqueue, as everyone's order should be the same. */ } -void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, s_time_t now) +void burn_credits(struct csched2_runqueue_data *rqd, + struct csched2_vcpu *svc, s_time_t now) { s_time_t delta; /* Assert svc is current */ ASSERT(svc==CSCHED2_VCPU(curr_on_cpu(svc->vcpu->processor))); - if ( is_idle_vcpu(svc->vcpu) ) + if ( unlikely(is_idle_vcpu(svc->vcpu)) ) { BUG_ON(svc->credit != CSCHED2_IDLE_CREDIT); return; @@ -753,13 +754,16 @@ void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, s delta = now - svc->start_time; - if ( delta > 0 ) { + if ( likely(delta > 0) ) + { SCHED_STAT_CRANK(burn_credits_t2c); t2c_update(rqd, delta, svc); svc->start_time = now; d2printk("b %pv c%d\n", svc->vcpu, svc->credit); - } else { + } + else if ( delta < 0 ) + { d2printk("%s: Time went backwards? now %"PRI_stime" start %"PRI_stime"\n", __func__, now, svc->start_time); }