From patchwork Tue Oct 7 12:13:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 38402 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 24557202E7 for ; Tue, 7 Oct 2014 12:17:15 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id d1sf2803802wiv.6 for ; Tue, 07 Oct 2014 05:17:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=U1b8gNKiyq6TQ2DB1vkyPMWS6e9ct+8tbZ8LsY1TOac=; b=GPHmdRSLePl1B71zLQ2Bv5K0Znf468RPYy3JyIOg9O6P4csC0iAWOLSwCXDMfRfxHX oJj/H6q/BQ67q5Dvaq0HxtvE1qzEclPA7kxpNqMZvZvV719nR3/dy78swuJrsES0Htrs 97of4TpdIj1X14Eht+mLvy9hJbHY1FQ57RRnJtg/JwZXIXByfBx6Iv6etLan05b8LyFs v3dolujKymCbRlW/gyFEiCLrC8YsahaRA0C9S75QyeMfmP7/dC9esu1xGo7src+U0ioo ydpV83H9D/LTJ4zf93uHfPSwIfnK0Q1dXLNBDcgWk+co9D4TR3ypArplATCYM0GaSp8n vw7g== X-Gm-Message-State: ALoCoQkPpP0Ig4Tglf1iYUWvAbcgxpO2DPNMBbUJ2Ny1mWUGqcTsG5gJXYCDrHD3eun9G6MsBOR5 X-Received: by 10.152.5.137 with SMTP id s9mr12189las.10.1412684234227; Tue, 07 Oct 2014 05:17:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.74 with SMTP id le10ls578419lac.1.gmail; Tue, 07 Oct 2014 05:17:14 -0700 (PDT) X-Received: by 10.112.78.38 with SMTP id y6mr3570424lbw.94.1412684234082; Tue, 07 Oct 2014 05:17:14 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by mx.google.com with ESMTPS id uo9si28326353lbb.134.2014.10.07.05.17.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Oct 2014 05:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gb8so6226144lab.31 for ; Tue, 07 Oct 2014 05:17:14 -0700 (PDT) X-Received: by 10.152.28.167 with SMTP id c7mr3730983lah.27.1412684233988; Tue, 07 Oct 2014 05:17:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp339125lbb; Tue, 7 Oct 2014 05:17:13 -0700 (PDT) X-Received: by 10.66.237.132 with SMTP id vc4mr3244903pac.19.1412684232325; Tue, 07 Oct 2014 05:17:12 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id hn2si15649903pbc.82.2014.10.07.05.17.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Oct 2014 05:17:12 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XbTfy-0007TB-3Y; Tue, 07 Oct 2014 12:15:34 +0000 Received: from mail-wg0-f51.google.com ([74.125.82.51]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XbTfv-0007MP-8Q for linux-arm-kernel@lists.infradead.org; Tue, 07 Oct 2014 12:15:31 +0000 Received: by mail-wg0-f51.google.com with SMTP id b13so9065653wgh.10 for ; Tue, 07 Oct 2014 05:15:09 -0700 (PDT) X-Received: by 10.180.13.226 with SMTP id k2mr4086521wic.70.1412684108932; Tue, 07 Oct 2014 05:15:08 -0700 (PDT) Received: from lmenx30s.lme.st.com (LPuteaux-656-01-48-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id v9sm20544897wjy.14.2014.10.07.05.15.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Oct 2014 05:15:08 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, preeti@linux.vnet.ibm.com, Morten.Rasmussen@arm.com, kamalesh@linux.vnet.ibm.com, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Subject: [PATCH v7 1/7] sched: add per rq cpu_capacity_orig Date: Tue, 7 Oct 2014 14:13:31 +0200 Message-Id: <1412684017-16595-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412684017-16595-1-git-send-email-vincent.guittot@linaro.org> References: <1412684017-16595-1-git-send-email-vincent.guittot@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141007_051531_492839_7CF86583 X-CRM114-Status: GOOD ( 14.62 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.51 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.51 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: nicolas.pitre@linaro.org, riel@redhat.com, daniel.lezcano@linaro.org, Vincent Guittot , efault@gmx.de, bsegall@google.com, linaro-kernel@lists.linaro.org, pjt@google.com, dietmar.eggemann@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This new field cpu_capacity_orig reflects the original capacity of a CPU before being altered by rt tasks and/or IRQ The cpu_capacity_orig will be used in several places to detect when the capacity of a CPU has been noticeably reduced so we can trig load balance to look for a CPU with better capacity. As an example, we can detect when a CPU handles a significant amount of irq (with CONFIG_IRQ_TIME_ACCOUNTING) but this CPU is seen as an idle CPU by scheduler whereas CPUs, which are really idle, are available In addition, this new cpu_capacity_orig will be used to evaluate the usage of a CPU by CFS tasks Signed-off-by: Vincent Guittot Reviewed-by: Kamalesh Babulal --- kernel/sched/core.c | 2 +- kernel/sched/fair.c | 8 +++++++- kernel/sched/sched.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c84bdc0..45ae52d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7087,7 +7087,7 @@ void __init sched_init(void) #ifdef CONFIG_SMP rq->sd = NULL; rq->rd = NULL; - rq->cpu_capacity = SCHED_CAPACITY_SCALE; + rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE; rq->post_schedule = 0; rq->active_balance = 0; rq->next_balance = jiffies; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bd61cff..c3674da 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4089,6 +4089,11 @@ static unsigned long capacity_of(int cpu) return cpu_rq(cpu)->cpu_capacity; } +static unsigned long capacity_orig_of(int cpu) +{ + return cpu_rq(cpu)->cpu_capacity_orig; +} + static unsigned long cpu_avg_load_per_task(int cpu) { struct rq *rq = cpu_rq(cpu); @@ -5776,6 +5781,7 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu) capacity >>= SCHED_CAPACITY_SHIFT; + cpu_rq(cpu)->cpu_capacity_orig = capacity; sdg->sgc->capacity_orig = capacity; if (sched_feat(ARCH_CAPACITY)) @@ -5837,7 +5843,7 @@ void update_group_capacity(struct sched_domain *sd, int cpu) * Runtime updates will correct capacity_orig. */ if (unlikely(!rq->sd)) { - capacity_orig += capacity_of(cpu); + capacity_orig += capacity_orig_of(cpu); capacity += capacity_of(cpu); continue; } diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 6130251..12483d8 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -579,6 +579,7 @@ struct rq { struct sched_domain *sd; unsigned long cpu_capacity; + unsigned long cpu_capacity_orig; unsigned char idle_balance; /* For active balancing */