From patchwork Fri Feb 27 15:54:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 45254 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E97020674 for ; Fri, 27 Feb 2015 16:01:24 +0000 (UTC) Received: by lbiw7 with SMTP id w7sf15213862lbi.0 for ; Fri, 27 Feb 2015 08:01:23 -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=RZ4WpGDnj8uQ2FK22NcTpz3XyTFMVO1uAuQyYigPRRA=; b=WmMZqmJ323osNOlwXsmf7MseP+GoZlXCve3u652+P2ss4XdRNk0xcI7PEAxZjBhcZo WnaXAB2P9ScBsdtJjALW7sjIf8mGyA+SbvdW+BFjzatuDxjE/ETUAx4kuCr2W38BlBPH 26MOegU7YcpcMhZjkepZiIZbr8cG0rx6eDowK9w0hIqko5NrO3Td7vGoLQDKsdrsbH+k sqiedQhglkR64CrxoLD9V0XLFUCJLdqohtyOIO8rRlwk6pdp5wJRVwn3U67PXepGimqm 486fM6mrDKSWn/MtrmGuftAfJ+RsHLxknj7eVySbOaAQJvwm4b9PIRK5VI97STQg7DqI ih0A== X-Gm-Message-State: ALoCoQk1yQ05ciRrCP3L4Gp+BfW/+Bu+GZZA7SLAQlA8GpJ8LJSTr/4pHI+YS2nyPQvqd7eK7Qc+ X-Received: by 10.194.239.41 with SMTP id vp9mr2181783wjc.5.1425052883227; Fri, 27 Feb 2015 08:01:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.197.34 with SMTP id ir2ls176112lac.84.gmail; Fri, 27 Feb 2015 08:01:23 -0800 (PST) X-Received: by 10.152.5.129 with SMTP id s1mr13113601las.105.1425052883030; Fri, 27 Feb 2015 08:01:23 -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 z5si2464948lbf.103.2015.02.27.08.01.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Feb 2015 08:01:22 -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 lbiw7 with SMTP id w7so18184367lbi.10 for ; Fri, 27 Feb 2015 08:01:22 -0800 (PST) X-Received: by 10.152.28.5 with SMTP id x5mr12996320lag.112.1425052882612; Fri, 27 Feb 2015 08:01:22 -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 h5csp4031339lbj; Fri, 27 Feb 2015 08:01:21 -0800 (PST) X-Received: by 10.68.162.225 with SMTP id yd1mr24606110pbb.75.1425052880493; Fri, 27 Feb 2015 08:01:20 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si5906014pdp.168.2015.02.27.08.01.14; Fri, 27 Feb 2015 08:01:19 -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 S1755181AbbB0QBJ (ORCPT + 28 others); Fri, 27 Feb 2015 11:01:09 -0500 Received: from mail-wg0-f41.google.com ([74.125.82.41]:41085 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754848AbbB0PzO (ORCPT ); Fri, 27 Feb 2015 10:55:14 -0500 Received: by wghl18 with SMTP id l18so21236616wgh.8 for ; Fri, 27 Feb 2015 07:55:13 -0800 (PST) X-Received: by 10.194.240.97 with SMTP id vz1mr29499967wjc.155.1425052513006; Fri, 27 Feb 2015 07:55:13 -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 y3sm6519459wju.14.2015.02.27.07.55.11 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Feb 2015 07:55:12 -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 v10 06/11] sched: add per rq cpu_capacity_orig Date: Fri, 27 Feb 2015 16:54:09 +0100 Message-Id: <1425052454-25797-7-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1425052454-25797-1-git-send-email-vincent.guittot@linaro.org> References: <1425052454-25797-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 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 97fe79c..28e3ec2 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 23c6dd7..9f06d24 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -603,6 +603,7 @@ struct rq { struct sched_domain *sd; unsigned long cpu_capacity; + unsigned long cpu_capacity_orig; unsigned char idle_balance; /* For active balancing */