From patchwork Fri May 23 18:16:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 30851 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 006B820369 for ; Fri, 23 May 2014 18:19:53 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id i17sf16840725qcy.10 for ; Fri, 23 May 2014 11:19:53 -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=hbqhDS05yN6/fzZ5EikrFd7ilSHqgB4F6o1i5ciRAXA=; b=EkDM4z6SCDEO7C1TVO2wUm8YxcTpTsCwp4kgKeE5h+ycO9fBZqxeboXqOMZ9n46tvw 4yDCE3sXvdQnqrd3EA4vJMuxiKhkBbRcX00ilRsWIKyCoBw5V1Q+BEp0rwQ8dxDMxQ9+ qm+mLOX81ZxwF7xIPsBRMXRSJJYi36hblU3sp0FgZ504Q5oGDyogcgrFPnmYTqRsGics J/L//oEOrSvt4kNrbGQJ0LZYCtBjnw1+Er6F9r/KdcwjC9ledC6VdI3DxOpUeBxPHwJI lt5oiyUMJcZ/6e9T2s3bpm1VxUbDrWkgL+2Ql+W4fesXAWdsoeJ1R9Eh8JHR+saIRPNO FUJw== X-Gm-Message-State: ALoCoQlFR90a3IgZ+TIpxw70wIi5/hxQKckyhum8yyfVAUjrmaZi5Jd+TayOhSKQNqDLByF8U3AR X-Received: by 10.236.151.114 with SMTP id a78mr2483648yhk.32.1400869193832; Fri, 23 May 2014 11:19:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.85 with SMTP id 79ls1900594qgk.41.gmail; Fri, 23 May 2014 11:19:53 -0700 (PDT) X-Received: by 10.220.7.131 with SMTP id d3mr1935845vcd.45.1400869193741; Fri, 23 May 2014 11:19:53 -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 sk5si2119758vec.60.2014.05.23.11.19.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 11:19:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so3358253vcb.9 for ; Fri, 23 May 2014 11:19:53 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr4836209vdb.20.1400869193661; Fri, 23 May 2014 11:19:53 -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.221.72 with SMTP id ib8csp52448vcb; Fri, 23 May 2014 11:19:53 -0700 (PDT) X-Received: by 10.68.99.194 with SMTP id es2mr8272134pbb.100.1400869192919; Fri, 23 May 2014 11:19:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rp16si5002645pab.170.2014.05.23.11.19.52 for ; Fri, 23 May 2014 11:19:52 -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 S1752188AbaEWSTo (ORCPT + 27 others); Fri, 23 May 2014 14:19:44 -0400 Received: from service87.mimecast.com ([91.220.42.44]:36143 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbaEWSQx (ORCPT ); Fri, 23 May 2014 14:16:53 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 23 May 2014 19:16:51 +0100 Received: from e103034-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 23 May 2014 19:16:51 +0100 From: Morten Rasmussen To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, peterz@infradead.org, mingo@kernel.org Cc: rjw@rjwysocki.net, vincent.guittot@linaro.org, daniel.lezcano@linaro.org, preeti@linux.vnet.ibm.com, dietmar.eggemann@arm.com Subject: [RFC PATCH 08/16] sched: Introduce SD_SHARE_CAP_STATES sched_domain flag Date: Fri, 23 May 2014 19:16:35 +0100 Message-Id: <1400869003-27769-9-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400869003-27769-1-git-send-email-morten.rasmussen@arm.com> References: <1400869003-27769-1-git-send-email-morten.rasmussen@arm.com> X-OriginalArrivalTime: 23 May 2014 18:16:51.0541 (UTC) FILETIME=[2B577850:01CF76B3] X-MC-Unique: 114052319165200101 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.220.178 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: , cpufreq is currently keeping it a secret which cpus are sharing clock source. The scheduler needs to know about clock domains as well to become more energy aware. The SD_SHARE_CAP_STATES domain indicates whether cpus belonging to the domain share capacity states (P-states). There is no connection with cpufreq (yet). The flag must be set by the arch specific topology code. Signed-off-by: Morten Rasmussen --- arch/arm/kernel/topology.c | 3 ++- include/linux/sched.h | 1 + kernel/sched/core.c | 10 +++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 0b9c1e0..c78d497 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -383,7 +383,8 @@ static inline const struct sched_energy *cpu_sys_energy(int cpu) static inline const int cpu_corepower_flags(void) { - return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; + return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN | \ + SD_SHARE_CAP_STATES; } static struct sched_domain_topology_level arm_topology[] = { diff --git a/include/linux/sched.h b/include/linux/sched.h index 4eb149b..62d61b5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -877,6 +877,7 @@ enum cpu_idle_type { #define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ #define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ #define SD_NUMA 0x4000 /* cross-node balancing */ +#define SD_SHARE_CAP_STATES 0x8000 /* Domain members share capacity state */ #ifdef CONFIG_SCHED_SMT static inline const int cpu_smt_flags(void) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 530a348..49b895a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5322,7 +5322,8 @@ static int sd_degenerate(struct sched_domain *sd) SD_BALANCE_EXEC | SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES | - SD_SHARE_POWERDOMAIN)) { + SD_SHARE_POWERDOMAIN | + SD_SHARE_CAP_STATES)) { if (sd->groups != sd->groups->next) return 0; } @@ -5354,7 +5355,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES | SD_PREFER_SIBLING | - SD_SHARE_POWERDOMAIN); + SD_SHARE_POWERDOMAIN | + SD_SHARE_CAP_STATES); if (nr_node_ids == 1) pflags &= ~SD_SERIALIZE; } @@ -6016,6 +6018,7 @@ static int sched_domains_curr_level; * SD_SHARE_PKG_RESOURCES - describes shared caches * SD_NUMA - describes NUMA topologies * SD_SHARE_POWERDOMAIN - describes shared power domain + * SD_SHARE_CAP_STATES - describes shared capacity states * * Odd one out: * SD_ASYM_PACKING - describes SMT quirks @@ -6025,7 +6028,8 @@ static int sched_domains_curr_level; SD_SHARE_PKG_RESOURCES | \ SD_NUMA | \ SD_ASYM_PACKING | \ - SD_SHARE_POWERDOMAIN) + SD_SHARE_POWERDOMAIN | \ + SD_SHARE_CAP_STATES) static struct sched_domain * sd_init(struct sched_domain_topology_level *tl, int cpu)