From patchwork Wed Mar 5 07:18:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 25734 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9836020540 for ; Wed, 5 Mar 2014 07:19:19 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf2290601oag.10 for ; Tue, 04 Mar 2014 23:19:19 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=/idDFoakSeKGX7C5MZ95jeFyNzVM9MaZLUGVcFRANLo=; b=O6TXhnMhzmZUqSPtG9KVgd9NMCCMDnWqRtIeEPDMoxKSbQYB8HmIkxCXAsn+eWtWNs Glo169aMJVVbnNDU4BUuXrBpzQ2KngTVuwJtA1Gxci+X0iV19vh6qoDh9OTchHwx1hkM lpbJYIamfRK+HszFzXgpg864G3vlInZYlJugrxy+wClvuEu254/iNLSS5YCb7fj/E0Rm LAsTYwVHIyE4hL96HvALegUuO8YXZiN7+gkCcx7plHdw59ilUqrbrTvMzAiMpX4dMjk6 IA6bFEc2HEUZCpuqhz+avghYUENP7jgi+nuA8RvuWQobeHDHZqbm84I+gHps/J5WIwcr BIzQ== X-Gm-Message-State: ALoCoQkWvvjQvu+2Avvr8lz3D4q0ZpoT/LWvesYq/NslN9PkJMLqmOAeYycL8vEFZS1QO18IEhev X-Received: by 10.182.24.134 with SMTP id u6mr633699obf.24.1394003959037; Tue, 04 Mar 2014 23:19:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.9 with SMTP id k9ls176564qgf.78.gmail; Tue, 04 Mar 2014 23:19:18 -0800 (PST) X-Received: by 10.58.238.35 with SMTP id vh3mr3319712vec.16.1394003958929; Tue, 04 Mar 2014 23:19:18 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id p9si446251vdv.122.2014.03.04.23.19.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 23:19:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so629518veb.36 for ; Tue, 04 Mar 2014 23:19:18 -0800 (PST) X-Received: by 10.220.10.2 with SMTP id n2mr542227vcn.26.1394003958807; Tue, 04 Mar 2014 23:19:18 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.130.193 with SMTP id u1csp183748vcs; Tue, 4 Mar 2014 23:19:18 -0800 (PST) X-Received: by 10.68.247.6 with SMTP id ya6mr4818047pbc.45.1394003957558; Tue, 04 Mar 2014 23:19:17 -0800 (PST) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by mx.google.com with ESMTPS id wh4si1394076pbc.357.2014.03.04.23.19.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 23:19:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.180 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=209.85.192.180; Received: by mail-pd0-f180.google.com with SMTP id v10so690089pde.11 for ; Tue, 04 Mar 2014 23:19:17 -0800 (PST) X-Received: by 10.67.13.226 with SMTP id fb2mr4883540pad.146.1394003957076; Tue, 04 Mar 2014 23:19:17 -0800 (PST) Received: from lmenb30s.lme.st.com (z88l218.static.ctm.net. [202.175.88.218]) by mx.google.com with ESMTPSA id zc6sm9364621pab.18.2014.03.04.23.19.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 23:19:16 -0800 (PST) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, tony.luck@intel.com, fenghua.yu@intel.com, schwidefsky@de.ibm.com, james.hogan@imgtec.com, cmetcalf@tilera.com, benh@kernel.crashing.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Cc: dietmar.eggemann@arm.com, preeti@linux.vnet.ibm.com, linaro-kernel@lists.linaro.org, Vincent Guittot Subject: [RFC 4/6] sched: powerpc: create a dedicated topology table Date: Wed, 5 Mar 2014 15:18:24 +0800 Message-Id: <1394003906-11630-5-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1394003906-11630-1-git-send-email-vincent.guittot@linaro.org> References: <1394003906-11630-1-git-send-email-vincent.guittot@linaro.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.128.177 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Create a dedicated topology table for handling asymetric feature. The current proposal creates a new level which describes which groups of CPUs take adavantge of SD_ASYM_PACKING. The useless level will be removed during the build of the sched_domain topology. Another solution would be to set SD_ASYM_PACKING in the sd_flags of SMT level during the boot sequence and before the build of the sched_domain topology. Signed-off-by: Vincent Guittot --- arch/powerpc/kernel/smp.c | 35 +++++++++++++++++++++++++++-------- kernel/sched/core.c | 6 ------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index ac2621a..75da054 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -755,6 +755,32 @@ int setup_profiling_timer(unsigned int multiplier) return 0; } +#ifdef CONFIG_SCHED_SMT +/* cpumask of CPUs with asymetric SMT dependancy */ +static const struct cpumask *cpu_asmt_mask(int cpu) +{ + if (cpu_has_feature(CPU_FTR_ASYM_SMT)) { + printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n"); + return topology_thread_cpumask(cpu); + } + return cpumask_of(cpu); +} +#endif + +static struct sched_domain_topology_level powerpc_topology[] = { +#ifdef CONFIG_SCHED_SMT + { cpu_asmt_mask, SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES | SD_ASYM_PACKING, SD_INIT_NAME(ASMT) }, + { cpu_smt_mask, SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES, SD_INIT_NAME(SMT) }, +#endif + { cpu_cpu_mask, SD_INIT_NAME(DIE) }, + { NULL, }, +}; + +static void __init set_sched_topology(void) +{ + sched_domain_topology = powerpc_topology; +} + void __init smp_cpus_done(unsigned int max_cpus) { cpumask_var_t old_mask; @@ -779,15 +805,8 @@ void __init smp_cpus_done(unsigned int max_cpus) dump_numa_cpu_topology(); -} + set_sched_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; } #ifdef CONFIG_HOTPLUG_CPU diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3479467..7606de0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5818,11 +5818,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() @@ -6000,7 +5995,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% */ - sd->flags |= arch_sd_sibling_asym_packing(); } else if (sd->flags & SD_SHARE_PKG_RESOURCES) { sd->imbalance_pct = 117;