Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp632517imm; Wed, 4 Jul 2018 03:20:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeAR7TKNVrkaRisa6MT6O3SuFNXiILH6ChmhOBDFJCqWIYpZs8NgMHYcnJso+fyJXbbGwZ3 X-Received: by 2002:a63:2ac4:: with SMTP id q187-v6mr1371314pgq.333.1530699623157; Wed, 04 Jul 2018 03:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530699623; cv=none; d=google.com; s=arc-20160816; b=bdEZpP72XgGf4ybuLldKqp7LTCbVzkNxZ/iaGMBsAiWGXxLAitxG0+0QiGJjPDuo1D trR2RqDOMFklSM4Q9Rtw3mcc4Mt5xzUgfntJG6sCwd45Az2GcQby61W+i4IyiuP9DP0e HygRu4Fp0GTuzkYiwmAkcAOYHdPP46FOe0tvCEzLpBax66VLSeJd4vEdwdBu3aRLXMUi wJrAGCFIT4TIw1Pmvca5It4Es8vHSAfkJ0T7aooNKHjPrypRvXCkS1A314SEGWa6ohiY HeWXCUNi9qEnE+Z97KOQldurc25XuzjfQnJdAbNykiawVbZU3gV5qipQlJsARXlBXDLO mgjw== 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=VdoandmgdUJUg6X0EMy3EEunBA/Za/GnhRU7QJEHmu8=; b=CNHNEmR8EuqqBL1sYrXr/OGYes3/J1HdqkQQgl6L2LdzP6CWIlF/X+KPaF5rrN5mkl m0a9CrP9zAo75jIF5aa2y+ebElQMrSpQE2zzqqC5Kf3lGZwNd3bkQXQvVa8PzssZX2lV GicyKG9In5uVygwmMmaW3kNFmkvLV9u86Scu5x8qT3VpI1r72YMDf7tPPnZCEeb96yTp tRjtwjuOZVsj+UxPSjJpT00v5IaospJFkBnTIg1MCiy3WaAm0Wrs78cDOyQTFt6J4NUR gMTQeabMxXiUaQ8BcB4q2Ro4ZjSRidRnS4z+oGj9lR/QYEPDZl1lduYxC07OSB+zl0O7 pqLQ== 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 j1-v6si3280397pfb.32.2018.07.04.03.20.08; Wed, 04 Jul 2018 03:20:23 -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 S934630AbeGDKSc (ORCPT + 99 others); Wed, 4 Jul 2018 06:18:32 -0400 Received: from foss.arm.com ([217.140.101.70]:35112 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934329AbeGDKSa (ORCPT ); Wed, 4 Jul 2018 06:18:30 -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 5A5FF1650; Wed, 4 Jul 2018 03:18:30 -0700 (PDT) Received: from e105550-lin.cambridge.arm.com (e105550-lin.cambridge.arm.com [10.1.211.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D63183F5AD; Wed, 4 Jul 2018 03:18:28 -0700 (PDT) From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: valentin.schneider@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, gaku.inami.xh@renesas.com, linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCHv4 11/12] sched/core: Disable SD_ASYM_CPUCAPACITY for root_domains without asymmetry Date: Wed, 4 Jul 2018 11:17:49 +0100 Message-Id: <1530699470-29808-12-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530699470-29808-1-git-send-email-morten.rasmussen@arm.com> References: <1530699470-29808-1-git-send-email-morten.rasmussen@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When hotplugging cpus out or creating exclusive cpusets (disabling sched_load_balance) systems which were asymmetric at boot might become symmetric. In this case leaving the flag set might lead to suboptimal scheduling decisions. The arch-code proving the flag doesn't have visibility of the cpuset configuration so it must either be told by passing a cpumask or the generic topology code has to verify if the flag should still be set when taking the actual sched_domain_span() into account. This patch implements the latter approach. We need to detect capacity based on calling arch_scale_cpu_capacity() directly as rq->cpu_capacity_orig hasn't been set yet early in the boot process. cc: Ingo Molnar cc: Peter Zijlstra Signed-off-by: Morten Rasmussen --- kernel/sched/topology.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 71330e0e41db..29c186961345 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1160,6 +1160,26 @@ sd_init(struct sched_domain_topology_level *tl, sd_id = cpumask_first(sched_domain_span(sd)); /* + * Check if cpu_map eclipses cpu capacity asymmetry. + */ + + if (sd->flags & SD_ASYM_CPUCAPACITY) { + int i; + bool disable = true; + long capacity = arch_scale_cpu_capacity(NULL, sd_id); + + for_each_cpu(i, sched_domain_span(sd)) { + if (capacity != arch_scale_cpu_capacity(NULL, i)) { + disable = false; + break; + } + } + + if (disable) + sd->flags &= ~SD_ASYM_CPUCAPACITY; + } + + /* * Convert topological properties into behaviour. */ -- 2.7.4