From patchwork Tue May 3 21:46:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9008651 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 D8CADBF29F for ; Tue, 3 May 2016 21:49:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFD8320373 for ; Tue, 3 May 2016 21:49:52 +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 9F2612037E for ; Tue, 3 May 2016 21:49:51 +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 1axi9g-0005OS-38; Tue, 03 May 2016 21:46:56 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axi9f-0005OD-8U for xen-devel@lists.xenproject.org; Tue, 03 May 2016 21:46:55 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 6D/BF-00425-E4C19275; Tue, 03 May 2016 21:46:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPIsWRWlGSWpSXmKPExsXiVRvkqOsroxl u8LPZxOL7lslMDowehz9cYQlgjGLNzEvKr0hgzbj9bwVjwQH+ivedt1kbGP9xdzFycQgJzGCU +PT9EDOIwyKwhlXi/6lTYI6EwCVWidPvnzJ2MXICOTESz3ueskHYFRIHp2xgArGFBFQkbm5fx QQxaj6TRN+NSWANwgJ6EkeO/mCHsMMlVm08CWazCRhIvNmxlxXEFhFQkri3ajLYIGYBb4mP+x rBFrAIqEr83j2ZBcTmBYovauoB6+UU8JG42fGYFWKxt8SalmNg9aICchIrL7ewQtQLSpyc+QS olwNopqbE+l36EOPlJba/ncM8gVFkFpKqWQhVs5BULWBkXsWoUZxaVJZapGtooZdUlJmeUZKb mJmja2hgqpebWlycmJ6ak5hUrJecn7uJERgBDECwg7Fpu+chRkkOJiVRXk8JzXAhvqT8lMqMx OKM+KLSnNTiQ4waHBwCE87Onc4kxZKXn5eqJMH7XwqoTrAoNT21Ii0zBxijMKUSHDxKIrwx0k Bp3uKCxNzizHSI1ClGXY4tU++tZRICmyElzssPUiQAUpRRmgc3ApYuLjHKSgnzMgIdKMRTkFq Um1mCKv+KUZyDUUmYtxxkCk9mXgncpldARzABHZG9XhXkiJJEhJRUA2OLgpbhrKMMydufbvMV 3nnY6FZiuKVlhtqq9/McN67ynbu3y0Iyxu3Mt5kJJ57c0BDY+JdRV/F5VUaWQs2jxfUqNsXNR 1RSHA6vSD8R/rH3kHtF7rlsY6cJ6j0dx+4lm+pv9nPPaHB5ypAiXR0j87FoYZvllo3WffOc3Z 5WT0yorGrdqm50SYmlOCPRUIu5qDgRAFbgAukSAwAA X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1462312013!25538641!1 X-Originating-IP: [74.125.82.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18864 invoked from network); 3 May 2016 21:46:53 -0000 Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by server-11.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 3 May 2016 21:46:53 -0000 Received: by mail-wm0-f65.google.com with SMTP id n129so6257415wmn.1 for ; Tue, 03 May 2016 14:46:53 -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=Na+tWN/G2n1e5oN+TZnith0MK73DgAEePiQF/ykIxTA=; b=xyN8GZ/Ll92/khpnYZCvN5AJ3QdBV2Lr4LLliWLQW08015wqQHclazXz9Bv50qnKgV itgvUXz6kBmg39+2iZnvmcbJzkHPHQ03MI8xjiIo3uM4qaUZ+wl2JMykvir22eSPHe8r krrOciQW9ZTVYF4xBS1o24U5bASiCQMx8yaYe8HfXcpzlYj1V81vrjO1c1q92/KY2QHT MCFbofH037yylS/MqltgtUqHm0rBBZpXzLGs9JsUGVEThIVR9Jt6fpgpXFVKXNwoDi5P v/jjrs84Ff/VgcAjEZF9Px2fB5kJ7ZsImUAWfAk6ztWahzoop8vQxBeQH81QIIHAxrYJ B6xQ== 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=Na+tWN/G2n1e5oN+TZnith0MK73DgAEePiQF/ykIxTA=; b=QHbRhk+kDYpV8hORr37VRWe0zdwbdy9n2VBNif4DoF7EKabWdPW7HXpmBkmAVcQbTX gZ1XxOQQoeJpuPEfWGTpOs0bd2m7D28lMD6FpOI+QG9hYS3tDcXIy9HnLxCJcA+8gB+I Rw8Hjy4rgEpLsD134cIHCi5bUpGdaShTsRVqhnYiCrQVDUwC2DWnPBXWepop+yU3pyak NfSJd6kq1ElxmWq4c0XvdM1bNWUarvbbYUPI5PTz0p4lyTsGbItHcCu9KYjFervwxwRm 3utL8Y/0hKZqpiYby4AQXf2cH9i6f3CvS+Wbe0Lt0SeA3dBNFd8V6arbzECIpt83wwzL AT9A== X-Gm-Message-State: AOPr4FVVNG3RpMBxChOacyvoYBfD3RH8gfRRjLKLSVyDzl0ME7yIQ22SVRKPWAQQN2RC4w== X-Received: by 10.194.26.41 with SMTP id i9mr5646300wjg.114.1462312013469; Tue, 03 May 2016 14:46:53 -0700 (PDT) Received: from Solace.fritz.box (net-93-65-132-113.cust.vodafonedsl.it. [93.65.132.113]) by smtp.gmail.com with ESMTPSA id yr1sm528060wjc.9.2016.05.03.14.46.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 May 2016 14:46:52 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 03 May 2016 23:46:50 +0200 Message-ID: <146231201072.25631.4767945168905205742.stgit@Solace.fritz.box> In-Reply-To: <146231184906.25631.6550047090421454264.stgit@Solace.fritz.box> References: <146231184906.25631.6550047090421454264.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Wei Liu , George Dunlap Subject: [Xen-devel] [PATCH for 4.7 3/4] xen: credit2: fix 2 (minor) issues in load tracking logic 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 All calculations that involve load_last_update uses quantities shifted by LOADAVG_GRANULARITY_SHIFT, so make sure that this is true even when the field is assigned a value for the first time, during vcpu allocation. Also, during migration, while the loads of both the source and destination runqueues certainly need changing, the vcpu being moved does not change its running/non-running status, and its calculated load should hence not be affected. Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap --- Cc: George Dunlap Cc: Wei Liu --- xen/common/sched_credit2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 803cc44..393364a 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -867,7 +867,7 @@ csched2_alloc_vdata(const struct scheduler *ops, struct vcpu *vc, void *dd) svc->weight = svc->sdom->weight; /* Starting load of 50% */ svc->avgload = 1ULL << (CSCHED2_PRIV(ops)->load_window_shift - 1); - svc->load_last_update = NOW(); + svc->load_last_update = NOW() >> LOADAVG_GRANULARITY_SHIFT; } else { @@ -1301,7 +1301,7 @@ static void migrate(const struct scheduler *ops, if ( __vcpu_on_runq(svc) ) { __runq_remove(svc); - update_load(ops, svc->rqd, svc, -1, now); + update_load(ops, svc->rqd, NULL, -1, now); on_runq=1; } __runq_deassign(svc); @@ -1314,7 +1314,7 @@ static void migrate(const struct scheduler *ops, __runq_assign(svc, trqd); if ( on_runq ) { - update_load(ops, svc->rqd, svc, 1, now); + update_load(ops, svc->rqd, NULL, 1, now); runq_insert(ops, svc->vcpu->processor, svc); runq_tickle(ops, svc->vcpu->processor, svc, now); SCHED_STAT_CRANK(migrate_on_runq);