From patchwork Thu Jul 3 16:26:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 33047 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 200C9203AC for ; Thu, 3 Jul 2014 16:30:46 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf2116030obc.5 for ; Thu, 03 Jul 2014 09:30:45 -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=ObeAcxNr3Cc7P4WS2XFJYKVpS7z9IUb+A666u1G8eU4=; b=ZNGFN3LJcrflnJx3GVIik3Gi1Dv57W8zc566tYgpS18O9F+ghbt5jd983w6ZorOgZa uzh1xf/n6clH83LZVQiyjYUk4bjuCy2V4wGFzIyTnrWWpSaGrWIELrAyFr8B6j9EEcKR rOFHJveyCfkFh0RPFGAH+8aW/9OOPQmS+7BvO4CNau9+kEjE7pcm5DIJletcaP1RMGCK XNE9Rgz835Cr+WV9CHxEjaGbgaIikxmbaAyN2rcfH9yW8f/oSG/1eCin8HczbjeqQhdY Tcfx6Q/KUU4Nd9/nPvfvcLP2ZBOwFWMa7/0S3X+5CubRrseYJP83MXgoi7qMzxtleqbK kszA== X-Gm-Message-State: ALoCoQncGIOmk/2DGttrW2Y0xO88//M1Tchs2EnHUqIp2R9ni9FRQnoN4tZ0wJm+2kwH5GKqH/Za X-Received: by 10.51.17.10 with SMTP id ga10mr5793581igd.4.1404405045674; Thu, 03 Jul 2014 09:30:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.107 with SMTP id f98ls540645qge.65.gmail; Thu, 03 Jul 2014 09:30:45 -0700 (PDT) X-Received: by 10.220.175.70 with SMTP id w6mr1180854vcz.72.1404405045487; Thu, 03 Jul 2014 09:30:45 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id dm6si14413033vcb.96.2014.07.03.09.30.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Jul 2014 09:30:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id i13so487294veh.36 for ; Thu, 03 Jul 2014 09:30:45 -0700 (PDT) X-Received: by 10.52.116.194 with SMTP id jy2mr1529964vdb.39.1404405045391; Thu, 03 Jul 2014 09:30:45 -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.221.37.5 with SMTP id tc5csp390614vcb; Thu, 3 Jul 2014 09:30:44 -0700 (PDT) X-Received: by 10.70.34.169 with SMTP id a9mr5110963pdj.28.1404405044502; Thu, 03 Jul 2014 09:30:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg5si965960pdb.81.2014.07.03.09.30.43; Thu, 03 Jul 2014 09:30:43 -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 S1759562AbaGCQ3D (ORCPT + 27 others); Thu, 3 Jul 2014 12:29:03 -0400 Received: from service87.mimecast.com ([91.220.42.44]:45624 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759301AbaGCQ0T (ORCPT ); Thu, 3 Jul 2014 12:26:19 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 03 Jul 2014 17:26:17 +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); Thu, 3 Jul 2014 17:26:17 +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, pjt@google.com Subject: [RFCv2 PATCH 14/23] sched: Introduce SD_SHARE_CAP_STATES sched_domain flag Date: Thu, 3 Jul 2014 17:26:01 +0100 Message-Id: <1404404770-323-15-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404404770-323-1-git-send-email-morten.rasmussen@arm.com> References: <1404404770-323-1-git-send-email-morten.rasmussen@arm.com> X-OriginalArrivalTime: 03 Jul 2014 16:26:17.0522 (UTC) FILETIME=[84184120:01CF96DB] X-MC-Unique: 114070317261712801 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.128.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: , 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 flag indicates whether cpus belonging to the sched_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 70915b1..0f9b27a 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -393,7 +393,8 @@ static inline const struct sched_group_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 b5eeae0..e5d8d57 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 d814064..ce43396 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5417,7 +5417,8 @@ static int sd_degenerate(struct sched_domain *sd) SD_BALANCE_EXEC | SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES | - SD_SHARE_POWERDOMAIN)) { + SD_SHARE_POWERDOMAIN | + SD_SHARE_CAP_STATES)) { if (sd->groups != sd->groups->next) return 0; } @@ -5449,7 +5450,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) SD_SHARE_CPUCAPACITY | 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; } @@ -6109,6 +6111,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 @@ -6118,7 +6121,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)