From patchwork Mon Sep 22 16:24:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 37693 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DE281202A1 for ; Mon, 22 Sep 2014 16:25:11 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id s18sf3515031lam.9 for ; Mon, 22 Sep 2014 09:25:10 -0700 (PDT) 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:content-type :content-transfer-encoding; bh=2Ts/kQhhEY+/nFJyYpdzEIkSUmcAPy6B84ihEaAvC/I=; b=gJ08y0psRRwXc7QxlelTN5duzhfRfZ3qaMNuI/Iyq5aUpLKiBjyKjdPL2HLyzUCItD PPGJiRzW77eneCSzUxwln2WcstVx3eqkIfx3SfBIOcNstVD5z3eN8uybRjDjHEheHg27 u5gPr5dpNCusCzlkZPYX9B67gsZrRmt9CouISY+kCo7iEGIQherTPYOJnG54dGBunUmt cjbWXH5iz9Kf1Am+OCVub13BEEV52o89xCeENXfZrD9VUs5MOp8zJYlhGoWe8+77G82p x6q+tfXVwnmqdL7R9R6JdiS0kmXn2LKvtpf7ejsOp6gqaOv5/mesrdc58JFL9I0MGgLa 8Oyw== X-Gm-Message-State: ALoCoQkgMGAmjVpiFCuRwRjXggIxIcP+D0T2OKJai0LsvjOdGb5MPJfUWNdu/bVTAX5Vrga+oU8/ X-Received: by 10.112.182.8 with SMTP id ea8mr619319lbc.11.1411403110706; Mon, 22 Sep 2014 09:25:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.71 with SMTP id t7ls559826lae.60.gmail; Mon, 22 Sep 2014 09:25:10 -0700 (PDT) X-Received: by 10.112.14.199 with SMTP id r7mr25602581lbc.58.1411403110411; Mon, 22 Sep 2014 09:25:10 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx.google.com with ESMTPS id tw9si15187876lbb.0.2014.09.22.09.25.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Sep 2014 09:25:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id ty20so6966490lab.21 for ; Mon, 22 Sep 2014 09:25:10 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr26735551lac.44.1411403110261; Mon, 22 Sep 2014 09:25:10 -0700 (PDT) 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.130.169 with SMTP id of9csp269566lbb; Mon, 22 Sep 2014 09:25:09 -0700 (PDT) X-Received: by 10.69.26.74 with SMTP id iw10mr5868763pbd.137.1411403108750; Mon, 22 Sep 2014 09:25:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yp10si16555059pac.20.2014.09.22.09.25.08 for ; Mon, 22 Sep 2014 09:25:08 -0700 (PDT) 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 S1754656AbaIVQZD (ORCPT + 27 others); Mon, 22 Sep 2014 12:25:03 -0400 Received: from service87.mimecast.com ([91.220.42.44]:60324 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754008AbaIVQYJ (ORCPT ); Mon, 22 Sep 2014 12:24:09 -0400 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 22 Sep 2014 17:24:07 +0100 Received: from e103034-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 22 Sep 2014 17:24:06 +0100 From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: dietmar.eggemann@arm.com, pjt@google.com, bsegall@google.com, vincent.guittot@linaro.org, nicolas.pitre@linaro.org, mturquette@linaro.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCH 4/7] arm: Micro-architecture invariant load tracking support Date: Mon, 22 Sep 2014 17:24:04 +0100 Message-Id: <1411403047-32010-5-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1411403047-32010-1-git-send-email-morten.rasmussen@arm.com> References: <1411403047-32010-1-git-send-email-morten.rasmussen@arm.com> X-OriginalArrivalTime: 22 Sep 2014 16:24:06.0549 (UTC) FILETIME=[A17D1C50:01CFD681] X-MC-Unique: 114092217240706701 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.48 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: , Adds micro-architecture difference into scheduler load-tracking scale-invariance correction factor for big.LITTLE systems. The factor is now: (current_freq(cpu) * uarch_factor(cpu) * SCHED_CAPACITY_SCALE) / (max_freq(cpu) * max_uarch_factor) Signed-off-by: Morten Rasmussen --- arch/arm/kernel/topology.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 3e9a979..9f499e2 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -79,6 +79,9 @@ static unsigned long *__cpu_capacity; static unsigned long middle_capacity = 1; +static unsigned long max_raw_capacity = 1; +static DEFINE_PER_CPU(unsigned long, cpu_raw_capacity); + /* * Iterate all CPUs' descriptor in DT and compute the efficiency * (as per table_efficiency). Also calculate a middle efficiency @@ -117,6 +120,9 @@ static void __init parse_dt_topology(void) if (cpu_eff->compatible == NULL) continue; + per_cpu(cpu_raw_capacity, cpu) = cpu_eff->efficiency; + max_raw_capacity = max(max_raw_capacity, cpu_eff->efficiency); + rate = of_get_property(cn, "clock-frequency", &len); if (!rate || len != 4) { pr_err("%s missing clock-frequency property\n", @@ -173,7 +179,8 @@ static void update_cpu_capacity(unsigned int cpu) * Scheduler load-tracking scale-invariance * * Provides the scheduler with a scale-invariance correction factor that - * compensates for frequency scaling. + * compensates for frequency scaling and micro-architecture differences between + * cpus. */ static DEFINE_PER_CPU(atomic_long_t, cpu_curr_freq); @@ -195,11 +202,15 @@ unsigned long arch_scale_load_capacity(int cpu) { unsigned long curr = atomic_long_read(&per_cpu(cpu_curr_freq, cpu)); unsigned long max = atomic_long_read(&per_cpu(cpu_max_freq, cpu)); + unsigned long ret; - if (!max) + if (!max || !per_cpu(cpu_raw_capacity, cpu)) return SCHED_CAPACITY_SCALE; - return (curr * SCHED_CAPACITY_SCALE) / max; + ret = (curr * SCHED_CAPACITY_SCALE) / max; + ret = (ret * per_cpu(cpu_raw_capacity, cpu)) / max_raw_capacity; + + return ret; } #else