From patchwork Mon Nov 3 16:54:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 40051 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0178521894 for ; Mon, 3 Nov 2014 16:56:47 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id h11sf2997725wiw.7 for ; Mon, 03 Nov 2014 08:56:47 -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=Bt5fdRjkkdfh4/mOL623cfzrj65p5uAVtGFBuVfUEPrAXyX3ReY2RbyyfIt8TjRFSN dgSzAaNT0iMOqmP3xejM2H6Rn+npRQHs763VPMBmcRfWf6KrIv6VaQbn1jm22lmcr5hg sMCRAWIpnuti2PtGE9p3iQjrQykjJy6aRizMASaCGI7NC/qmVPATXH0fBPaL+5/mEnJa gn/Rhoy+w+hKnMTP1CdWUnCE6xieVxuy0Qs28zLLFqXUXHBfoEGdCh9rBVHm4UsL07+p fRlG1J5DuSVjyV+tWkgjIGUeVUJMt9j1avt/1Xh2ZHDZVr2sBM4C0vMsFKcw4oPv89IV qlHw== X-Gm-Message-State: ALoCoQkFljga8MFy9GZD7WKY70kq7KLcV0cJVXnfehrGIvmPKPpZu4PFkNrHwvIdyKzq21MRtUxP X-Received: by 10.112.169.68 with SMTP id ac4mr4963lbc.24.1415033807172; Mon, 03 Nov 2014 08:56:47 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.74 with SMTP id a10ls750833laa.82.gmail; Mon, 03 Nov 2014 08:56:47 -0800 (PST) X-Received: by 10.152.29.41 with SMTP id g9mr53176444lah.83.1415033807003; Mon, 03 Nov 2014 08:56:47 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id yf1si33223713lab.63.2014.11.03.08.56.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Nov 2014 08:56:46 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so1167665lbi.8 for ; Mon, 03 Nov 2014 08:56:45 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr52386109laa.71.1415033805569; Mon, 03 Nov 2014 08:56:45 -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.141.34 with SMTP id rl2csp20995lbb; Mon, 3 Nov 2014 08:56:44 -0800 (PST) X-Received: by 10.68.93.132 with SMTP id cu4mr44336724pbb.36.1415033803804; Mon, 03 Nov 2014 08:56:43 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mr2si15757716pdb.73.2014.11.03.08.56.43 for ; Mon, 03 Nov 2014 08:56:43 -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 S1753422AbaKCQ40 (ORCPT + 25 others); Mon, 3 Nov 2014 11:56:26 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:32806 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753352AbaKCQ4K (ORCPT ); Mon, 3 Nov 2014 11:56:10 -0500 Received: by mail-wi0-f172.google.com with SMTP id bs8so7061739wib.5 for ; Mon, 03 Nov 2014 08:56:09 -0800 (PST) X-Received: by 10.180.94.34 with SMTP id cz2mr17273672wib.4.1415033769582; Mon, 03 Nov 2014 08:56:09 -0800 (PST) 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 s8sm22798078wjx.9.2014.11.03.08.56.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Nov 2014 08:56:08 -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, linux-arm-kernel@lists.infradead.org Cc: riel@redhat.com, efault@gmx.de, nicolas.pitre@linaro.org, linaro-kernel@lists.linaro.org, Vincent Guittot Subject: [PATCH v9 06/10] sched: add per rq cpu_capacity_orig Date: Mon, 3 Nov 2014 17:54:43 +0100 Message-Id: <1415033687-23294-7-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415033687-23294-1-git-send-email-vincent.guittot@linaro.org> References: <1415033687-23294-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.217.177 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 */