From patchwork Wed Feb 4 18:30:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 44378 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f198.google.com (mail-we0-f198.google.com [74.125.82.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE5A521173 for ; Wed, 4 Feb 2015 18:31:09 +0000 (UTC) Received: by mail-we0-f198.google.com with SMTP id q59sf2461873wes.1 for ; Wed, 04 Feb 2015 10:31:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=1QQV7jYCiQNqZUd8NX3s9b2aUdIcJ1yRTradMHnTiQs=; b=hnPklEfOyDdGCfgA94AOuT9WONrwndY6cv/NAm110vpn7HgGfRvvYeraMItrZmhtz7 LL9M+bm8XaIkfC9YPzkQn6yGpFtnk/Db/+9+mNhWVxgttOAHcHXvwCzkQZJrJE2gu+4D 6G6CdhG8YEixozocWt+10J/a9IN8UfBqK1F51p2SGMywiY7ScZoqTuS4XjZE5/Xql+/a JBNWgYgLrbR4Sm//rtOmX0KTg1gggLhhkdJnZ49/1ubC0c7Nsrec0wGvf7VxCk2oB6hX ML085CZlEf4Xxtty6Pt8lwd/tqtA0SAXoSZsUwPzRrz0kjnJxY2yTrQiLsweSLMHMw5A c6KA== X-Gm-Message-State: ALoCoQmVVXZ75CVZ0kKHXdKq71AueCaOscE81c+hAJ9wQkdvHFM7MoD78MbLNKfkjVYLvnPeDh3t X-Received: by 10.113.5.167 with SMTP id cn7mr1738120lbd.21.1423074668896; Wed, 04 Feb 2015 10:31:08 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.168 with SMTP id an8ls72466lac.62.gmail; Wed, 04 Feb 2015 10:31:08 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr32757434laa.80.1423074668539; Wed, 04 Feb 2015 10:31:08 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id w1si2108813lag.6.2015.02.04.10.31.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 10:31:08 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gq15so3147537lab.12 for ; Wed, 04 Feb 2015 10:31:08 -0800 (PST) X-Received: by 10.112.181.41 with SMTP id dt9mr31799626lbc.56.1423074668111; Wed, 04 Feb 2015 10:31:08 -0800 (PST) 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.35.133 with SMTP id h5csp664491lbj; Wed, 4 Feb 2015 10:31:07 -0800 (PST) X-Received: by 10.68.231.102 with SMTP id tf6mr48606340pbc.40.1423074663408; Wed, 04 Feb 2015 10:31:03 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kj2si3186143pbc.40.2015.02.04.10.31.02; Wed, 04 Feb 2015 10:31:03 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161569AbbBDSa5 (ORCPT + 29 others); Wed, 4 Feb 2015 13:30:57 -0500 Received: from foss-mx-na.foss.arm.com ([217.140.108.86]:41486 "EHLO foss-mx-na.foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934085AbbBDSau (ORCPT ); Wed, 4 Feb 2015 13:30:50 -0500 Received: from foss-smtp-na-1.foss.arm.com (unknown [10.80.61.8]) by foss-mx-na.foss.arm.com (Postfix) with ESMTP id 6104E516; Wed, 4 Feb 2015 12:30:44 -0600 (CST) Received: from collaborate-mta1.arm.com (highbank-bc01-b06.austin.arm.com [10.112.81.134]) by foss-smtp-na-1.foss.arm.com (Postfix) with ESMTP id 3324E5FAC2; Wed, 4 Feb 2015 12:30:42 -0600 (CST) Received: from e105550-lin.cambridge.arm.com (e105550-lin.cambridge.arm.com [10.2.131.193]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 97F9B13F6EE; Wed, 4 Feb 2015 12:30:40 -0600 (CST) From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: vincent.guittot@linaro.org, dietmar.eggemann@arm.com, yuyang.du@intel.com, preeti@linux.vnet.ibm.com, mturquette@linaro.org, nico@linaro.org, rjw@rjwysocki.net, juri.lelli@arm.com, linux-kernel@vger.kernel.org Subject: [RFCv3 PATCH 06/48] sched: add per rq cpu_capacity_orig Date: Wed, 4 Feb 2015 18:30:43 +0000 Message-Id: <1423074685-6336-7-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423074685-6336-1-git-send-email-morten.rasmussen@arm.com> References: <1423074685-6336-1-git-send-email-morten.rasmussen@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: morten.rasmussen@arm.com 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.53 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Vincent Guittot 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 Reviewed-by: Kamalesh Babulal Acked-by: Morten Rasmussen --- 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 e628cb1..48f9053 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7212,7 +7212,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 cfe3aea..3fdad38 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4351,6 +4351,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); @@ -6028,6 +6033,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); @@ -6082,7 +6088,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 e61f00e..09bb18b 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -604,6 +604,7 @@ struct rq { struct sched_domain *sd; unsigned long cpu_capacity; + unsigned long cpu_capacity_orig; unsigned char idle_balance; /* For active balancing */