From patchwork Mon Jan 20 12:39:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 23384 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B04E42107B for ; Mon, 20 Jan 2014 12:41:27 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 20sf7043912yks.0 for ; Mon, 20 Jan 2014 04:41:26 -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:content-type :content-transfer-encoding; bh=ECF166PO8bmy5S4aAx//M/ybgITPIDhJP0JCQBrGJYI=; b=ejM7e/7SqOKlnMsxQ7FcxMgRYDOpxjzqh/oDjddRARTFRbEaTYSDtLqrGbr6+LYTgj MDc/Ht8630+ZSrPecnACOHHBIeYSt5ihOin1pTDmy+cHtShgE22gVX4hhNnIibLT+QWb A18CU2mZ3zC3oDeF47s/U18AUZFMcBBwaR+bTrnGoQ/+1L81SZEJC24PkTIqZgpYUUSp T85d9k8Bs8p+JJyA0qlQExOAlUWPiGsLSXCL2sRC1FG9wi2F7tn4TFOTagZkSv8PkiYM aCAecrt+wskS9hTs2bbztvhKQYJJsWfZWrjsPXUxKkqL3XU9uEcIpY4XoT1VCRMteiPY I1vA== X-Gm-Message-State: ALoCoQl5DpWcdZyqBT8JTJiflDFUlrWRnWFHx1BzPAebxAT63/QuDi1NvKr/3XpVvr9h+/bcbDse X-Received: by 10.236.27.79 with SMTP id d55mr5243814yha.17.1390221686899; Mon, 20 Jan 2014 04:41:26 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.146 with SMTP id s18ls507110qge.8.gmail; Mon, 20 Jan 2014 04:41:26 -0800 (PST) X-Received: by 10.52.38.33 with SMTP id d1mr8741435vdk.4.1390221686690; Mon, 20 Jan 2014 04:41:26 -0800 (PST) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id g4si287914vch.148.2014.01.20.04.41.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 04:41:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id w20so2818221vbb.13 for ; Mon, 20 Jan 2014 04:41:26 -0800 (PST) X-Received: by 10.52.164.203 with SMTP id ys11mr57494vdb.37.1390221686570; Mon, 20 Jan 2014 04:41:26 -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.220.174.196 with SMTP id u4csp55908vcz; Mon, 20 Jan 2014 04:41:26 -0800 (PST) X-Received: by 10.68.247.6 with SMTP id ya6mr18253831pbc.45.1390221685665; Mon, 20 Jan 2014 04:41:25 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id eb3si1398534pbd.17.2014.01.20.04.41.25; Mon, 20 Jan 2014 04:41:25 -0800 (PST) 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 S1753744AbaATMlS (ORCPT + 26 others); Mon, 20 Jan 2014 07:41:18 -0500 Received: from service87.mimecast.com ([91.220.42.44]:51772 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752879AbaATMkI (ORCPT ); Mon, 20 Jan 2014 07:40:08 -0500 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 20 Jan 2014 12:40:06 +0000 Received: from e103711-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Jan 2014 12:40:05 +0000 From: dietmar.eggemann@arm.com To: peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, morten.rasmussen@arm.com, chris.redpath@arm.com Cc: linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com Subject: [RFC v2 PATCH 09/11] sched: provide SD_ASYM_PACKING via topology info table Date: Mon, 20 Jan 2014 12:39:46 +0000 Message-Id: <1390221588-20473-10-git-send-email-dietmar.eggemann@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1390221588-20473-1-git-send-email-dietmar.eggemann@arm.com> References: <1390221588-20473-1-git-send-email-dietmar.eggemann@arm.com> X-OriginalArrivalTime: 20 Jan 2014 12:40:05.0644 (UTC) FILETIME=[BEE104C0:01CF15DC] X-MC-Unique: 114012012400610101 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: dietmar.eggemann@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.54 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: , From: Dietmar Eggemann The provision of the sd topology flag SD_ASYM_PACKING is shifted from the weak function arch_sd_sibling_asym_packing() towards an arch specific topology info table. Signed-off-by: Dietmar Eggemann --- arch/powerpc/kernel/smp.c | 34 +++++++++++++++++++++++++--------- kernel/sched/core.c | 13 ------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index c1cf4a1522d9..f8ba79dd9147 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -760,6 +760,30 @@ int setup_profiling_timer(unsigned int multiplier) return 0; } +#ifdef CONFIG_SCHED_SMT +static inline int arch_cpu_smt_flags(int cpu) +{ + int flags = SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES; + + if (cpu_has_feature(CPU_FTR_ASYM_SMT)) { + printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n"); + flags |= SD_ASYM_PACKING; + } + + return flags; +} +#endif + +static struct sched_domain_topology_info topology_info[] = { +#ifdef CONFIG_SCHED_SMT + { cpu_smt_mask, arch_cpu_smt_flags, SD_NAME(SIBLING) }, +#endif +#ifdef CONFIG_SCHED_MC + { cpu_coregroup_mask, cpu_coregroup_flags, SD_NAME(MC) }, +#endif + { cpu_cpu_mask, SD_NAME(CPU) }, +}; + void __init smp_cpus_done(unsigned int max_cpus) { cpumask_var_t old_mask; @@ -784,15 +808,7 @@ void __init smp_cpus_done(unsigned int max_cpus) dump_numa_cpu_topology(); -} - -int arch_sd_sibling_asym_packing(void) -{ - if (cpu_has_feature(CPU_FTR_ASYM_SMT)) { - printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n"); - return SD_ASYM_PACKING; - } - return 0; + set_sd_topology_info(topology_info, ARRAY_SIZE(topology_info)); } #ifdef CONFIG_HOTPLUG_CPU diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 79f34cc5f547..a3e945021e97 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5233,11 +5233,6 @@ static void init_sched_groups_power(int cpu, struct sched_domain *sd) atomic_set(&sg->sgp->nr_busy_cpus, sg->group_weight); } -int __weak arch_sd_sibling_asym_packing(void) -{ - return 0*SD_ASYM_PACKING; -} - /* * Initializers for schedule domains * Non-inlined to reduce accumulated stack pressure in build_sched_domains() @@ -5662,14 +5657,6 @@ sd_init(struct sched_domain_topology_level *tl, int cpu) if (sd->flags & SD_SHARE_CPUPOWER) { sd->imbalance_pct = 110; sd->smt_gain = 1178; /* ~15% */ - - /* - * Call SMT specific arch topology function. - * This goes away once the powerpc arch uses - * the new interface for scheduler domain - * setup. - */ - sd->flags |= arch_sd_sibling_asym_packing(); } else if (sd->flags & SD_SHARE_PKG_RESOURCES) { sd->cache_nice_tries = 1; sd->busy_idx = 2;