From patchwork Fri Mar 28 13:22:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 27281 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2B5F20062 for ; Fri, 28 Mar 2014 13:24:32 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id jt11sf11966628pbb.3 for ; Fri, 28 Mar 2014 06:24:32 -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; bh=eZvd+Hkx08NPU8ac0ZDfRvo1/tvUcaiqso+Kny81+io=; b=KB1wC24FkLmao7a6hwKkFfzjo3tlcclW5h3L+8bcWNlK4g2g0hIj7NQHJPIeuxxBYs +0j61gd7WqaeSazWZuef7VrXKTScZc1nvSYP1jNA28e2NqVvzxLFKlC2NoYjxUJZTsrM kRneRa6GN+XPrYfCEMtO20PKPZfjRgCxaYUiOeQ7cCTw7rUCojckD2DcdiMwCFBKxuL1 DLvfMPTj3a5RNOA4TvyioeVoGZfh/WySFTF9NlH8jcgMJQ6/XJO0UQiADCoI/NKqWP4O yJ2p+6op0KqJskflnElL2PnjajGdhArH+ntmDQHz5dcItj/6hZOWV7aGxxc+1ndmUb1y miqg== X-Gm-Message-State: ALoCoQmmG+hP7ibWtxxV2OxFacPbvHJ4tkb7T7TJfWRt//HX3ZwbH91Ge/M/krU9m+4Oh4S+/NUr X-Received: by 10.66.26.146 with SMTP id l18mr3126926pag.2.1396013072107; Fri, 28 Mar 2014 06:24:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.241 with SMTP id u104ls1511779qga.81.gmail; Fri, 28 Mar 2014 06:24:31 -0700 (PDT) X-Received: by 10.58.37.232 with SMTP id b8mr352895vek.27.1396013071891; Fri, 28 Mar 2014 06:24:31 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id vd8si1235686vdc.106.2014.03.28.06.24.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 06:24:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id im17so5810150vcb.37 for ; Fri, 28 Mar 2014 06:24:31 -0700 (PDT) X-Received: by 10.58.211.69 with SMTP id na5mr99979vec.30.1396013071814; Fri, 28 Mar 2014 06:24:31 -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.220.12.8 with SMTP id v8csp8373vcv; Fri, 28 Mar 2014 06:24:31 -0700 (PDT) X-Received: by 10.66.240.130 with SMTP id wa2mr8705795pac.73.1396013070943; Fri, 28 Mar 2014 06:24:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ub3si878345pac.481.2014.03.28.06.24.30; Fri, 28 Mar 2014 06:24:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752108AbaC1NYZ (ORCPT + 27 others); Fri, 28 Mar 2014 09:24:25 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:49112 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305AbaC1NYX (ORCPT ); Fri, 28 Mar 2014 09:24:23 -0400 Received: by mail-wi0-f179.google.com with SMTP id f8so751622wiw.6 for ; Fri, 28 Mar 2014 06:24:21 -0700 (PDT) X-Received: by 10.180.9.103 with SMTP id y7mr12587138wia.55.1396013061578; Fri, 28 Mar 2014 06:24:21 -0700 (PDT) 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 q2sm7237157wix.5.2014.03.28.06.24.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 06:24:20 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Cc: preeti@linux.vnet.ibm.com, Morten.Rasmussen@arm.com, efault@gmx.de, linaro-kernel@lists.linaro.org, Vincent Guittot Subject: [RFC 1/4] sched: extend the usage of cpu_power_orig Date: Fri, 28 Mar 2014 14:22:26 +0100 Message-Id: <1396012949-6227-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1396012949-6227-1-git-send-email-vincent.guittot@linaro.org> References: <1396012949-6227-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=neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , cpu_power_orig is only changed for SMT system in order to reflect the lower capacity of CPUs. Heterogenous system also have to reflect an original capacity that is different from the default value. Create a more generic function arch_scale_cpu_power that can be also used by non SMT platform to set cpu_power_orig. The weak behavior of arch_scale_cpu_power is the previous SMT one in order to keep backward compatibility in the use of cpu_power_orig. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7e9bd0b..ed42061 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5559,6 +5559,20 @@ unsigned long __weak arch_scale_smt_power(struct sched_domain *sd, int cpu) return default_scale_smt_power(sd, cpu); } +unsigned long __weak arch_scale_cpu_power(struct sched_domain *sd, int cpu) +{ + unsigned long weight = sd->span_weight; + + if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) { + if (sched_feat(ARCH_POWER)) + return arch_scale_smt_power(sd, cpu); + else + return default_scale_smt_power(sd, cpu); + } + + return SCHED_POWER_SCALE; +} + static unsigned long scale_rt_power(int cpu) { struct rq *rq = cpu_rq(cpu); @@ -5590,18 +5604,12 @@ static unsigned long scale_rt_power(int cpu) static void update_cpu_power(struct sched_domain *sd, int cpu) { - unsigned long weight = sd->span_weight; unsigned long power = SCHED_POWER_SCALE; struct sched_group *sdg = sd->groups; - if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) { - if (sched_feat(ARCH_POWER)) - power *= arch_scale_smt_power(sd, cpu); - else - power *= default_scale_smt_power(sd, cpu); + power *= arch_scale_cpu_power(sd, cpu); - power >>= SCHED_POWER_SHIFT; - } + power >>= SCHED_POWER_SHIFT; sdg->sgp->power_orig = power;