From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752822AbbC0LmJ (ORCPT ); Fri, 27 Mar 2015 07:42:09 -0400 Received: from terminus.zytor.com ([198.137.202.10]:37103 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752509AbbC0LmG (ORCPT ); Fri, 27 Mar 2015 07:42:06 -0400 Date: Fri, 27 Mar 2015 04:41:28 -0700 From: tip-bot for Vincent Guittot Message-ID: Cc: hpa@zytor.com, morten.rasmussen@arm.com, tglx@linutronix.de, peterz@infradead.org, kamalesh@linux.vnet.ibm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, vincent.guittot@linaro.org Reply-To: hpa@zytor.com, morten.rasmussen@arm.com, linux-kernel@vger.kernel.org, mingo@kernel.org, vincent.guittot@linaro.org, tglx@linutronix.de, peterz@infradead.org, kamalesh@linux.vnet.ibm.com In-Reply-To: <1425052454-25797-7-git-send-email-vincent.guittot@linaro.org> References: <1425052454-25797-7-git-send-email-vincent.guittot@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched: Add struct rq::cpu_capacity_orig Git-Commit-ID: ca6d75e6908efbc350d536e0b496ebdac36b20d2 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ca6d75e6908efbc350d536e0b496ebdac36b20d2 Gitweb: http://git.kernel.org/tip/ca6d75e6908efbc350d536e0b496ebdac36b20d2 Author: Vincent Guittot AuthorDate: Fri, 27 Feb 2015 16:54:09 +0100 Committer: Ingo Molnar CommitDate: Fri, 27 Mar 2015 09:36:02 +0100 sched: Add struct rq::cpu_capacity_orig 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: - 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. - evaluate the available capacity for CFS tasks Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kamalesh Babulal Acked-by: Morten Rasmussen Cc: Morten.Rasmussen@arm.com Cc: dietmar.eggemann@arm.com Cc: efault@gmx.de Cc: linaro-kernel@lists.linaro.org Cc: nicolas.pitre@linaro.org Cc: preeti@linux.vnet.ibm.com Cc: riel@redhat.com Link: http://lkml.kernel.org/r/1425052454-25797-7-git-send-email-vincent.guittot@linaro.org Signed-off-by: Ingo Molnar --- 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 feda520..7022e90 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7216,7 +7216,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 dc7c693..10f84c3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4363,6 +4363,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); @@ -6040,6 +6045,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; capacity *= scale_rt_capacity(cpu); @@ -6094,7 +6100,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 3600002..be56dfd 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -615,6 +615,7 @@ struct rq { struct sched_domain *sd; unsigned long cpu_capacity; + unsigned long cpu_capacity_orig; unsigned char idle_balance; /* For active balancing */