Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3672023imm; Mon, 20 Aug 2018 02:46:35 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyy4Sstc77bSYXEXcQyrOl8YdgFHB4vWuqd2uF9v1tszKi9hjMP4xtAAmlhBx9cD2ZySNFt X-Received: by 2002:a17:902:22:: with SMTP id 31-v6mr44584718pla.190.1534758395595; Mon, 20 Aug 2018 02:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534758395; cv=none; d=google.com; s=arc-20160816; b=uQ7KxPQlCAALjJGhLoWwsY3trAAoMLty4pubQBMXJZfNRPkMVvrJOiuAzyJnLvoTTA XCPMpa8l5NfXG4EOqVZJKnnf6cvm311fKiSGGwHBwBrSnzE1YWRFDGK5QIk4j4MlATjN 5PulhXP6SzDARsJc1tpiP/eh5Gz76B1KhfoieBApRDxDoRqwTo5WZ8t9g1Vdjj3BA8pc GfUvLaQiYbBVGVLn3pGGdSwIW0dOZiwFYfoL1vuiAOly3PtzAnJknvIb5AR8ylhteY3u C7ubmvDWcuHJloSQsH5dVXIH9p8vYswUpAxuBJZd3muxNio2b8GaLDNVI5+i1SAFBJ3n F85g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1kl3KWt6dx3qX+9adKeUBc5r3Nf0+nofto9lcW4BwPs=; b=Pf2hBcB2W6H9WkOh8x+tLQ8kdhvz1b9hoHyNC+5fb5Wm3trNnf8t4S3/+6uU4egoBx bko7KeI9DeT4ZwG0y7yYxZj3BQhxTHcr42oIxDc6WqH0bk41+cElzLAUMJ7e9M48VTFr S23XTGYB5OwhpFUfmskyywNlpHybQLZWRe3L/nxiYl7k1AOIaGqRq9Bp50aev/E36PA2 T2NHm6WddiBLsio/RTlsOLc7OG1YUU5EzTXozzIJ20TkuZeeFnLd2GPo6s/zoSW38tDQ qGx/siDC9ATfZtmv2VmQQOBSgQB6J9jqSKzkNW54OqoNwVUY1SZQcPLLJyQCF9vGUaq8 EJJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r23-v6si10116289pfr.252.2018.08.20.02.46.20; Mon, 20 Aug 2018 02:46:35 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726740AbeHTM7y (ORCPT + 99 others); Mon, 20 Aug 2018 08:59:54 -0400 Received: from foss.arm.com ([217.140.101.70]:34952 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbeHTM7y (ORCPT ); Mon, 20 Aug 2018 08:59:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 91C2E15BE; Mon, 20 Aug 2018 02:44:59 -0700 (PDT) Received: from queper01-lin.local (queper01-lin.emea.arm.com [10.4.13.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A5B03F2EA; Mon, 20 Aug 2018 02:44:55 -0700 (PDT) From: Quentin Perret To: peterz@infradead.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: gregkh@linuxfoundation.org, mingo@redhat.com, dietmar.eggemann@arm.com, morten.rasmussen@arm.com, chris.redpath@arm.com, patrick.bellasi@arm.com, valentin.schneider@arm.com, vincent.guittot@linaro.org, thara.gopinath@linaro.org, viresh.kumar@linaro.org, tkjos@google.com, joel@joelfernandes.org, smuckle@google.com, adharmap@codeaurora.org, skannan@codeaurora.org, pkondeti@codeaurora.org, juri.lelli@redhat.com, edubezval@gmail.com, srinivas.pandruvada@linux.intel.com, currojerez@riseup.net, javi.merino@kernel.org, quentin.perret@arm.com Subject: [PATCH v6 06/14] sched/topology: Lowest CPU asymmetry sched_domain level pointer Date: Mon, 20 Aug 2018 10:44:12 +0100 Message-Id: <20180820094420.26590-7-quentin.perret@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180820094420.26590-1-quentin.perret@arm.com> References: <20180820094420.26590-1-quentin.perret@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add another member to the family of per-cpu sched_domain shortcut pointers. This one, sd_asym_cpucapacity, points to the lowest level at which the SD_ASYM_CPUCAPACITY flag is set. While at it, rename the sd_asym shortcut to sd_asym_packing to avoid confusions. Generally speaking, the largest opportunity to save energy via scheduling comes from a smarter exploitation of heterogeneous platforms (i.e. big.LITTLE). Consequently, the sd_asym_cpucapacity shortcut will be used at first as the lowest domain where Energy-Aware Scheduling (EAS) should be applied. For example, it is possible to apply EAS within a socket on a multi-socket system, as long as each socket has an asymmetric topology. Cross-sockets wake-up balancing will only happen when the system is over-utilized, or this_cpu and prev_cpu are in different sockets. cc: Ingo Molnar cc: Peter Zijlstra Suggested-by: Morten Rasmussen Signed-off-by: Quentin Perret --- kernel/sched/fair.c | 2 +- kernel/sched/sched.h | 3 ++- kernel/sched/topology.c | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c60616796483..c28c7adcc7b3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9167,7 +9167,7 @@ static void nohz_balancer_kick(struct rq *rq) } } - sd = rcu_dereference(per_cpu(sd_asym, cpu)); + sd = rcu_dereference(per_cpu(sd_asym_packing, cpu)); if (sd) { for_each_cpu(i, sched_domain_span(sd)) { if (i == cpu || diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 97d79429e755..4b884e467545 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1203,7 +1203,8 @@ DECLARE_PER_CPU(int, sd_llc_size); DECLARE_PER_CPU(int, sd_llc_id); DECLARE_PER_CPU(struct sched_domain_shared *, sd_llc_shared); DECLARE_PER_CPU(struct sched_domain *, sd_numa); -DECLARE_PER_CPU(struct sched_domain *, sd_asym); +DECLARE_PER_CPU(struct sched_domain *, sd_asym_packing); +DECLARE_PER_CPU(struct sched_domain *, sd_asym_cpucapacity); extern struct static_key_false sched_asym_cpucapacity; struct sched_group_capacity { diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 545e2c7b6e66..4c6a36a8d7b8 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -508,7 +508,8 @@ DEFINE_PER_CPU(int, sd_llc_size); DEFINE_PER_CPU(int, sd_llc_id); DEFINE_PER_CPU(struct sched_domain_shared *, sd_llc_shared); DEFINE_PER_CPU(struct sched_domain *, sd_numa); -DEFINE_PER_CPU(struct sched_domain *, sd_asym); +DEFINE_PER_CPU(struct sched_domain *, sd_asym_packing); +DEFINE_PER_CPU(struct sched_domain *, sd_asym_cpucapacity); DEFINE_STATIC_KEY_FALSE(sched_asym_cpucapacity); static void update_top_cache_domain(int cpu) @@ -534,7 +535,10 @@ static void update_top_cache_domain(int cpu) rcu_assign_pointer(per_cpu(sd_numa, cpu), sd); sd = highest_flag_domain(cpu, SD_ASYM_PACKING); - rcu_assign_pointer(per_cpu(sd_asym, cpu), sd); + rcu_assign_pointer(per_cpu(sd_asym_packing, cpu), sd); + + sd = lowest_flag_domain(cpu, SD_ASYM_CPUCAPACITY); + rcu_assign_pointer(per_cpu(sd_asym_cpucapacity, cpu), sd); } /* -- 2.17.1