From patchwork Tue Sep 23 16:08:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 37745 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0FF7420792 for ; Tue, 23 Sep 2014 16:11:24 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf2205218eek.4 for ; Tue, 23 Sep 2014 09:11:24 -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=mbTEXh3sn2cSr+wcawhgUCUETCvuIUtbHQje+f8kwek=; b=AQKV9smLMb7A7DsrLRwhW4OqKIohysWDRZKIGZiSN2zt04dKuo8sIBy9BOd10azPDv iJRAL8Q0WbJSkIUb1ijfFxeEGzsOmDgYhXr+2TYfcAjQDgyOalJirDSpJxefs5VU9ue6 kyVP+KE2RmOGQx6v0QKlQGZC7inrch+j3/97/78R9UsJVPHV3iYTOVB/Qc649VJi767o v162b2DXfqiTnxjfqzvDqacodfqzBKt8Xm5m2VughWcZfWSJoDf2cF22QWIulHLhtqgZ FuvG7W99mBTOf7zzaAclnKHc/zzlKX1pVbnEEuXWFSHrVc+Y33Df3zjNCDw/7WSr5oEG 9d1g== X-Gm-Message-State: ALoCoQkmhOoUe3O9Ly18zqsNEF/CJmzWB7NNBf6xDkOS4Tqn7GOH1d7k4wopRwwSI3JhGINRLPL1 X-Received: by 10.112.6.138 with SMTP id b10mr17066lba.18.1411488684185; Tue, 23 Sep 2014 09:11:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.129 with SMTP id o1ls63701lal.75.gmail; Tue, 23 Sep 2014 09:11:24 -0700 (PDT) X-Received: by 10.152.36.37 with SMTP id n5mr389183laj.93.1411488684047; Tue, 23 Sep 2014 09:11:24 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by mx.google.com with ESMTPS id n5si19282028lbc.90.2014.09.23.09.11.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 09:11:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id hz20so9000096lab.1 for ; Tue, 23 Sep 2014 09:11:23 -0700 (PDT) X-Received: by 10.112.53.230 with SMTP id e6mr565607lbp.100.1411488683940; Tue, 23 Sep 2014 09:11:23 -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 of9csp442351lbb; Tue, 23 Sep 2014 09:11:23 -0700 (PDT) X-Received: by 10.68.130.72 with SMTP id oc8mr532425pbb.153.1411488682272; Tue, 23 Sep 2014 09:11:22 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d2si14706475pdi.18.2014.09.23.09.11.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2014 09:11:22 -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 1XWSfB-0002JW-EB; Tue, 23 Sep 2014 16:10:01 +0000 Received: from mail-wg0-f41.google.com ([74.125.82.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XWSez-000264-P7 for linux-arm-kernel@lists.infradead.org; Tue, 23 Sep 2014 16:09:50 +0000 Received: by mail-wg0-f41.google.com with SMTP id k14so4654228wgh.0 for ; Tue, 23 Sep 2014 09:09:29 -0700 (PDT) X-Received: by 10.180.20.139 with SMTP id n11mr24620326wie.22.1411488569331; Tue, 23 Sep 2014 09:09:29 -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 hm5sm16427901wjb.2.2014.09.23.09.09.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 09:09:28 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, preeti@linux.vnet.ibm.com, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 1/6] sched: add per rq cpu_capacity_orig Date: Tue, 23 Sep 2014 18:08:00 +0200 Message-Id: <1411488485-10025-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411488485-10025-1-git-send-email-vincent.guittot@linaro.org> References: <1411488485-10025-1-git-send-email-vincent.guittot@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140923_090949_961434_EE0E6EDD X-CRM114-Status: GOOD ( 14.58 ) 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.41 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.41 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, dietmar.eggemann@arm.com, bsegall@google.com, linaro-kernel@lists.linaro.org, pjt@google.com, Morten.Rasmussen@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.42 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 frequency scaling, rt tasks and/or IRQ The cpu_capacity_orig will be used in several places to detect when the capapcity 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 the 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 2a93b87..e20f203 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7056,7 +7056,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 2a1e6ac..622f8b0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4092,6 +4092,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); @@ -5765,6 +5770,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)) @@ -5826,7 +5832,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 1bc6aad..f332e45 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -575,6 +575,7 @@ struct rq { struct sched_domain *sd; unsigned long cpu_capacity; + unsigned long cpu_capacity_orig; unsigned char idle_balance; /* For active balancing */