From patchwork Fri Jun 17 23:13:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9185161 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 54C6B601C0 for ; Fri, 17 Jun 2016 23:15:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4459927BE5 for ; Fri, 17 Jun 2016 23:15:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3908127F07; Fri, 17 Jun 2016 23:15:27 +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 AC09327EED for ; Fri, 17 Jun 2016 23:15:26 +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 1bE2xJ-0004SH-Mg; Fri, 17 Jun 2016 23:13:41 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bE2xJ-0004RD-2a for xen-devel@lists.xenproject.org; Fri, 17 Jun 2016 23:13:41 +0000 Received: from [85.158.139.211] by server-14.bemta-5.messagelabs.com id 75/2E-29442-42484675; Fri, 17 Jun 2016 23:13:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPIsWRWlGSWpSXmKPExsXiVRvkrKvckhJ u0DzByOL7lslMDowehz9cYQlgjGLNzEvKr0hgzeiato6x4Ax/xf/1R9kaGNfxdDFycQgJzGCU aDi8jB3EYRFYwypxavt7NhBHQuASq8SHT89Yuhg5gZwYidkXT0LZlRK3r35iB7GFBFQkbm5fx QQxahGTxIN339hAEsICehJHjv5gh7ATJI50zQOz2QQMJN7s2MsKYosIKEncWzUZrJlZoIFRYs LjXUwgCRYBVYnlV6Yzg9i8Aj4ST6ZOA9vMKeArsfrKLjaIzT4SF889ArNFBeQkVl5uYYWoF5Q 4OfMJUD0H0FBNifW79EHCzALyEtvfzmGewCgyC0nVLISqWUiqFjAyr2JUL04tKkst0jXTSyrK TM8oyU3MzNE1NDDVy00tLk5MT81JTCrWS87P3cQIjAAGINjBOLXB+RCjJAeTkijvlcqUcCG+p PyUyozE4oz4otKc1OJDjBocHAITzs6dziTFkpefl6okwavZDFQnWJSanlqRlpkDjFGYUgkOHi URXkOQNG9xQWJucWY6ROoUoy7Hlqn31jIJgc2QEudVASkSACnKKM2DGwFLF5cYZaWEeRmBDhT iKUgtys0sQZV/xSjOwagkzHutCWgKT2ZeCdymV0BHMAEdoTkvGeSIkkSElFQDY98X3nuJi8OP CrDdMPxybuKTMKfbeX62RUxLDiVOuL7WartZZiKTaXjiFvHaBzZ6UQKZrjVd8kfEH55wU5n76 juPQNLh0FfvtjS32ZsHBOVcUbb8f4SdL0zVS0akqVP8v8eLHFGBAmOl5mrvmebhkrHlBVwn9a Z3ZAvoGc17vO5qhTDTqVolluKMREMt5qLiRAAD8EBBEgMAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1466205219!9072898!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 54356 invoked from network); 17 Jun 2016 23:13:39 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-14.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jun 2016 23:13:39 -0000 Received: by mail-wm0-f67.google.com with SMTP id r201so1107933wme.0 for ; Fri, 17 Jun 2016 16:13:39 -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=/EL76Gdj2+iXVBakmzxJx46dpgxdxSd2wONmJ6hlLLs=; b=EH0b0xvwudldSyu9C+OKohmjgdmUn/EsZXJUKb/Xd8tCWq0WUYi7B+ttiv6X2jB9aI OWKvmoT/pZVcAUtBP4t7XFHDgsy0HO3IahoGB0wP61rQQmup+G+8GwVeuFpyrW3iRXob ZY6cLLh76J5kY1TaWEb4OyB4KxBJ+QqSss2OqWRQuwE3wTtnAhcjokTeVTzIr/imLYNQ gx1W4QeYUjXL510G22Y+kAZcrke3+0itKxU+GtCFCWR3ZRGG0h5BV6ONfWGR4Zv98v12 G8tTfCgvMO6FTc7a+iyrjokmLJ9tQCyAj3pbC/czAgFZeWKptWpvy0i7J0EqU1eT5FbY 0NTQ== 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=/EL76Gdj2+iXVBakmzxJx46dpgxdxSd2wONmJ6hlLLs=; b=GHieQ6RjoPZFK6/iXO6EQuSzu3JnKM+8JYf+BnuXj8lhwS5plM80wRlWBlFeg1v/l6 de4mIKnkg5hvSnpWozwdUffMWp8hOQryn8tsZTB/f1YamksEcCeQdOQJo1CIAZhInY/n ofzWEVms2L+cZVLxy4MfivJn3MVcUOWaGxPY2SqtoxzH1QwWg0U6iW+e0Vp0jIlFJ21Q uxVLy2nc11245FeZp7oKV99YPjMtBz1HRjiDIdoFdEKM+lW3rS3rh+q/tDjjbq+Vycqf hA44J0lVjJRb5fSX7QCyR1t9wi2vh8jXhq4M8tGP6u580YzDxZm8cG11InMOfqhhruLk UvvA== X-Gm-Message-State: ALyK8tIAjDABzJVAJSoOjT9V8xXm3ruZAFQ3CY0LaZ5uFJKrf5VeC511QjIkMe33sf0rpA== X-Received: by 10.194.104.227 with SMTP id gh3mr4287192wjb.3.1466205219507; Fri, 17 Jun 2016 16:13:39 -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 ag3sm10235878wjc.39.2016.06.17.16.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2016 16:13:39 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Sat, 18 Jun 2016 01:13:37 +0200 Message-ID: <146620521750.29766.12008171749820205436.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 19/19] xen: credit2: use cpumask_first instead of cpumask_any when choosing cpu 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 because it is cheaper, and there is no much point in randomizing which cpu gets selected anyway, as such choice will be overridden shortly after, in runq_tickle(). If we really feel the need (e.g., we prove it worth with benchmarking), we can record the last cpu which was used by csched2_cpu_pick() and migrate() in a per-runq variable, and then use cpumask_cycle()... but this really does not look necessary. Signed-off-by: Dario Faggioli --- Cc: George Dunlap Cc: Anshul Makkar Cc: David Vrabel --- 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 a8b3a85..afd432e 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -1545,7 +1545,7 @@ csched2_cpu_pick(const struct scheduler *ops, struct vcpu *vc) { cpumask_and(cpumask_scratch, vc->cpu_hard_affinity, &svc->migrate_rqd->active); - new_cpu = cpumask_any(cpumask_scratch); + new_cpu = cpumask_first(cpumask_scratch); if ( new_cpu < nr_cpu_ids ) goto out_up; } @@ -1604,7 +1604,7 @@ csched2_cpu_pick(const struct scheduler *ops, struct vcpu *vc) cpumask_and(cpumask_scratch, vc->cpu_hard_affinity, &prv->rqd[min_rqi].active); - new_cpu = cpumask_any(cpumask_scratch); + new_cpu = cpumask_first(cpumask_scratch); BUG_ON(new_cpu >= nr_cpu_ids); out_up: @@ -1718,7 +1718,7 @@ static void migrate(const struct scheduler *ops, cpumask_and(cpumask_scratch, svc->vcpu->cpu_hard_affinity, &trqd->active); - svc->vcpu->processor = cpumask_any(cpumask_scratch); + svc->vcpu->processor = cpumask_first(cpumask_scratch); ASSERT(svc->vcpu->processor < nr_cpu_ids); __runq_assign(svc, trqd);