Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2573792imm; Mon, 10 Sep 2018 03:20:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaXHYZHo+n6vV+t91onTwu7MVWiiBxQmNZnVIFTTVtusbMbMvaMycIoTDAwEw/lhKaoPNjQ X-Received: by 2002:a63:231c:: with SMTP id j28-v6mr21667082pgj.332.1536574850500; Mon, 10 Sep 2018 03:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536574850; cv=none; d=google.com; s=arc-20160816; b=qQNUWm7jg7b3K89FCskvR2CxtxyMLrJ5wm+OqjAV2bV0NIpAUS7CAwzA0w7CnKKDdV SXako8U7bKYXEsI1ELLYzxrRdr8VokgFCZsTAY9XwoKQPhJFGDtV0a1MdeXZ+t2cSEEW To45fFueyY/MKGHyX6vKuD5h0Qky/wYgIEWSoFcsLf6m67I1VadZlW6IvpCV079vX7+E DMdvDElhUSmFqmhwEieEmhu3OKDUQDZvMSdR/7+h3UFqydkmKnNzJgCKmusLyDWQknHz TG8YcVIuByA6D7vZ4XPbMJUdMTJWZLyX8SZhOYBib3WnPx7lNxvytjuqIgw8ZxmsaOh/ ko2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=Ic50L8iE6Bhc06I2HAYLmonL/EU1wI9e+SH8ICYUrEw=; b=IaLVPJnWJ/mFCW3qx4t7p/NlKReY4k1zqxv1OtjEcLMxwuDUQlXmtxRhiDotOPXP3d IRAX6JRt+7v1LFGOPQox9QwrHQgpO60A/HpR4r3HgBsTc40bwIrTj9X0RhLO1kow79Px v1RTltJl0cC5RsvD6nImtRo48ZciU2gOe2fkuZWMK2pLOyiFobvMN5hLinHmVSdVvd0Z QuboFPnKC/927ZXGngmH27PO3Ws3Igxccso51/CQwL0j732zhAEIHAFWe7nzFQw4xzQK I702MP5o++1mYKnSoKyH6TetTeG9vqMj6Ifl4RjNa5BMs29Bl7uLVtL9x70Tj71KXcwL S0oQ== 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 h185-v6si16833556pfc.172.2018.09.10.03.20.35; Mon, 10 Sep 2018 03:20:50 -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 S1728235AbeIJPM2 (ORCPT + 99 others); Mon, 10 Sep 2018 11:12:28 -0400 Received: from terminus.zytor.com ([198.137.202.136]:39967 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727614AbeIJPM2 (ORCPT ); Mon, 10 Sep 2018 11:12:28 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8AAIkcW1808678 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 10 Sep 2018 03:18:46 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8AAIkUZ1808675; Mon, 10 Sep 2018 03:18:46 -0700 Date: Mon, 10 Sep 2018 03:18:46 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Morten Rasmussen Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, morten.rasmussen@arm.com, hpa@zytor.com, mingo@kernel.org, torvalds@linux-foundation.org Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, morten.rasmussen@arm.com, hpa@zytor.com, torvalds@linux-foundation.org In-Reply-To: <1530699470-29808-13-git-send-email-morten.rasmussen@arm.com> References: <1530699470-29808-13-git-send-email-morten.rasmussen@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/core: Disable SD_PREFER_SIBLING on asymmetric CPU capacity domains Git-Commit-ID: 9c63e84db29bcf584040931ad97c2edd11e35f6c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 9c63e84db29bcf584040931ad97c2edd11e35f6c Gitweb: https://git.kernel.org/tip/9c63e84db29bcf584040931ad97c2edd11e35f6c Author: Morten Rasmussen AuthorDate: Wed, 4 Jul 2018 11:17:50 +0100 Committer: Ingo Molnar CommitDate: Mon, 10 Sep 2018 11:05:54 +0200 sched/core: Disable SD_PREFER_SIBLING on asymmetric CPU capacity domains The 'prefer sibling' sched_domain flag is intended to encourage spreading tasks to sibling sched_domain to take advantage of more caches and core for SMT systems. It has recently been changed to be on all non-NUMA topology level. However, spreading across domains with CPU capacity asymmetry isn't desirable, e.g. spreading from high capacity to low capacity CPUs even if high capacity CPUs aren't overutilized might give access to more cache but the CPU will be slower and possibly lead to worse overall throughput. To prevent this, we need to remove SD_PREFER_SIBLING on the sched_domain level immediately below SD_ASYM_CPUCAPACITY. Signed-off-by: Morten Rasmussen Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: dietmar.eggemann@arm.com Cc: gaku.inami.xh@renesas.com Cc: valentin.schneider@arm.com Cc: vincent.guittot@linaro.org Link: http://lkml.kernel.org/r/1530699470-29808-13-git-send-email-morten.rasmussen@arm.com Signed-off-by: Ingo Molnar --- kernel/sched/topology.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 2536e1b938f9..7ffad0d3a4eb 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1126,7 +1126,7 @@ sd_init(struct sched_domain_topology_level *tl, | 0*SD_SHARE_CPUCAPACITY | 0*SD_SHARE_PKG_RESOURCES | 0*SD_SERIALIZE - | 0*SD_PREFER_SIBLING + | 1*SD_PREFER_SIBLING | 0*SD_NUMA | sd_flags , @@ -1152,17 +1152,21 @@ sd_init(struct sched_domain_topology_level *tl, if (sd->flags & SD_ASYM_CPUCAPACITY) { struct sched_domain *t = sd; + /* + * Don't attempt to spread across CPUs of different capacities. + */ + if (sd->child) + sd->child->flags &= ~SD_PREFER_SIBLING; + for_each_lower_domain(t) t->flags |= SD_BALANCE_WAKE; } if (sd->flags & SD_SHARE_CPUCAPACITY) { - sd->flags |= SD_PREFER_SIBLING; sd->imbalance_pct = 110; sd->smt_gain = 1178; /* ~15% */ } else if (sd->flags & SD_SHARE_PKG_RESOURCES) { - sd->flags |= SD_PREFER_SIBLING; sd->imbalance_pct = 117; sd->cache_nice_tries = 1; sd->busy_idx = 2; @@ -1173,6 +1177,7 @@ sd_init(struct sched_domain_topology_level *tl, sd->busy_idx = 3; sd->idle_idx = 2; + sd->flags &= ~SD_PREFER_SIBLING; sd->flags |= SD_SERIALIZE; if (sched_domains_numa_distance[tl->numa_level] > RECLAIM_DISTANCE) { sd->flags &= ~(SD_BALANCE_EXEC | @@ -1182,7 +1187,6 @@ sd_init(struct sched_domain_topology_level *tl, #endif } else { - sd->flags |= SD_PREFER_SIBLING; sd->cache_nice_tries = 1; sd->busy_idx = 2; sd->idle_idx = 1;