Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5180650imm; Wed, 12 Sep 2018 02:14:36 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZMleCxr0rTGg4cJG553Ijz3rYjXbVweS+olqCUHCE/qshraansSukgujCq4kJ876G8IWjZ X-Received: by 2002:a17:902:25ab:: with SMTP id y40-v6mr1087795pla.120.1536743675957; Wed, 12 Sep 2018 02:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536743675; cv=none; d=google.com; s=arc-20160816; b=UkDhBshWf8u3Q/wSlzbeYsiMngxsywasqwY/yLMasmz7PHDyD7xkHsn5oBZUmDyN2F IxtYGyKLaE/ueLhm14SGgTMZ/0anRRekyv7zXJI9HgAL01rXWR1BHihJ76RXC/kQ9odb xoySzRasL46pbFEJhK/J7bfiJh516uN74Fy8Ui1JJ5CZwgHKigw4loNzrNfxtm1V5N/c pcsaSFq373MSEcUXG/n3kxqBM6bD8bsx6tUyyQy3nJ4i09m+TPlciqXKlTg69BTvl2+y o35td6vZhT/M1QHZ7Ifb8pi6wUXpLEbC9If5+14BF9l0Xu69ZmIzxln0S9paAvdJ5EDU o76A== 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; bh=pB3c2y+gL1WOFK2wV81F1TXl864DMJMt6UwLSZIw7/o=; b=o/faBYX7C459+41axQyIue2xuWpCvRSaZ5E5rNnWFBlkQFzwTvsOhd4UpAr3QXJP6e SsLdX/ClKdMIktadpcITabDwL8TLV4Mr84vbHmdOPz9z0dWG/6NG491D8zERIbZL+iqP UuKCiUeOZDljpc+SSuoEGXwfacxnnlEGafogbbwY15zzcj7MmOTCcsQv0CDwox8l+iry +L4LLUVLbq7L3Nnxg6SqCPy6JeLr68lNic38X98pVQnVPodWSYLQP+PtX9o1kdKGbRG6 EFHmJmInviwvG4yGZEbYJrCAzSEtOFt/pgLbRwaZdthoU6ZCMh+1q3CO62uHpHkxnWyg LCIw== 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 c2-v6si435173pfn.212.2018.09.12.02.14.21; Wed, 12 Sep 2018 02:14: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 S1728196AbeILORa (ORCPT + 99 others); Wed, 12 Sep 2018 10:17:30 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55924 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727753AbeILOR3 (ORCPT ); Wed, 12 Sep 2018 10:17:29 -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 E8FA915BF; Wed, 12 Sep 2018 02:13:51 -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 D18283F703; Wed, 12 Sep 2018 02:13:47 -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 v7 07/14] sched/topology: Lowest CPU asymmetry sched_domain level pointer Date: Wed, 12 Sep 2018 10:13:02 +0100 Message-Id: <20180912091309.7551-8-quentin.perret@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912091309.7551-1-quentin.perret@arm.com> References: <20180912091309.7551-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 9922615592a8..7ced27701454 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 8019a9bf281d..10e37ffea19a 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.18.0