From patchwork Thu Jan 15 10:09:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 43163 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0C042240BA for ; Thu, 15 Jan 2015 10:17:12 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id t10sf6861799eei.2 for ; Thu, 15 Jan 2015 02:17:11 -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=ynBiMojZb4bIGgY9B6RLJ0UlRTJDVXOFrXkrhWdOCxs=; b=Ay8PsqnIGfIXncaONza4wNbvgVQmwgSX2dpnEwr/90EdnhsHjbzLqe/2OzzARfvkt0 OCXndPxPRgOVs8q6foVoOb6v9jWNjDxZTgG35Z+PXLImk37t3c81lFNoSXBzlqDnE6JG 6tbb39/wY4aH6KQhT9Ef+SVpCxSNQYgImlGphziPpPCtOApZB5jBQFzkRNcClNg1lNZ0 2U+c6w3IFtNRSrpdaigMV/Wpu6vwWT+PwGQruYKI+U9cPLvd5TTPwl9hFg3WijCPxB7D GkD5oaJvfCggSbxhezu2830+1bLVAjXE9X4KDah463I67baX4nzTz7q28B4yD4aEgC9o eGNw== X-Gm-Message-State: ALoCoQl4viqN87KBcDm1ovNqvMxEjeEco8YfgWGA//5uQyo3oRj0wJes0PFTJRTIkHDO1LGJZ/nn X-Received: by 10.152.8.67 with SMTP id p3mr200190laa.4.1421317031174; Thu, 15 Jan 2015 02:17:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.195 with SMTP id da3ls246035lac.32.gmail; Thu, 15 Jan 2015 02:17:11 -0800 (PST) X-Received: by 10.152.3.100 with SMTP id b4mr8568291lab.68.1421317031004; Thu, 15 Jan 2015 02:17:11 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id dh3si987385lac.61.2015.01.15.02.17.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 02:17:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id s18so12765736lam.2 for ; Thu, 15 Jan 2015 02:17:10 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr8820198laz.71.1421317030845; Thu, 15 Jan 2015 02:17:10 -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.9.200 with SMTP id c8csp1982375lbb; Thu, 15 Jan 2015 02:17:10 -0800 (PST) X-Received: by 10.70.140.167 with SMTP id rh7mr13165573pdb.108.1421317029059; Thu, 15 Jan 2015 02:17:09 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bs2si1367184pad.67.2015.01.15.02.17.07; Thu, 15 Jan 2015 02:17:09 -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 S1753414AbbAOKQw (ORCPT + 28 others); Thu, 15 Jan 2015 05:16:52 -0500 Received: from mail-wg0-f50.google.com ([74.125.82.50]:52091 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752766AbbAOKMn (ORCPT ); Thu, 15 Jan 2015 05:12:43 -0500 Received: by mail-wg0-f50.google.com with SMTP id a1so13921364wgh.9 for ; Thu, 15 Jan 2015 02:12:42 -0800 (PST) X-Received: by 10.194.108.9 with SMTP id hg9mr16361412wjb.68.1421316762636; Thu, 15 Jan 2015 02:12:42 -0800 (PST) Received: from lmenx30s.lme.st.com (LPuteaux-656-1-48-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id fi10sm15113674wib.13.2015.01.15.02.12.38 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 02:12:41 -0800 (PST) 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 Cc: riel@redhat.com, efault@gmx.de, nicolas.pitre@linaro.org, dietmar.eggemann@arm.com, linaro-kernel@lists.linaro.org, Vincent Guittot Subject: [PATCH RESEND v9 06/10] sched: add per rq cpu_capacity_orig Date: Thu, 15 Jan 2015 11:09:26 +0100 Message-Id: <1421316570-23097-7-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421316570-23097-1-git-send-email-vincent.guittot@linaro.org> References: <1421316570-23097-1-git-send-email-vincent.guittot@linaro.org> 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: 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.43 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: , 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 --- 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 b37c27b..4782733 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4141,6 +4141,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); @@ -5821,6 +5826,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); @@ -5875,7 +5881,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 fc5b152..aaaa3e4 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -585,6 +585,7 @@ struct rq { struct sched_domain *sd; unsigned long cpu_capacity; + unsigned long cpu_capacity_orig; unsigned char idle_balance; /* For active balancing */