Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp874604ybt; Wed, 1 Jul 2020 12:10:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW52mqW7ydtxcqFtipFjnxwQdOy/vVao4ynbAXyYPyQwWVB+NxKBY4cscn3zne7Sx0ob3t X-Received: by 2002:a17:906:b0d3:: with SMTP id bk19mr25895418ejb.167.1593630616339; Wed, 01 Jul 2020 12:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593630616; cv=none; d=google.com; s=arc-20160816; b=eCaEk0PxOj8R1Qws+tjMOxh7v138cpRG7Bkz1gG9JcAYjcCV77PB8p9vnnflDIM17k 4TL9XBpXVnmOK1AWFDp+FJpSfGDfcSlkF/j26Og5e2Z0P2vNNJ8tZ3DDVV1oRopNYfxq /SP1AhWas8trwk3vbFiQrtUfweQp5wta/eC8VvA9enJz3ACmyhfH4rsHj8RjE7PfkFLF Tiix0FPkzMr1ljbBfUzomCyQPNK7Nx8zkQNEKYcny8weNWWqym0Ti05DGPeePcZKdLYX HQEPAoey4nUHG/MEtIgwPBMt2s4WsR0NiD59P72+c9jbsW7u87OHMCAEWswOc5iiw9R5 nv+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9frH7MyrM4dVg+siENG2s2unUqftoLLDN0u3x3kHYDg=; b=TKLmzPVLB1PXNUD1RuaYNicZjHCOQjxm1aAvFmHWRpFxmwfJDvV3lUV0fvRj80/omC 7CF4G9fVV/V/dTWlf7II2WDPIijjzynRO7d93p5WvB8Lan3cs1IZhY7RQgu9Yo8TiRd6 yul9S+ODQcsY/kZcAnlFpuP5R/PRm2Tw9RPCDddXCeyXaH9+aYQdTnzJ3Tmko8J4qckT QvBtc+X1UmrLa5xkSMju/XsCin3cjbDRtFT7ObHgEZ9XdoGpHlB6TfLHS2/EOfuZGVCV dJ092l2zO8uvYGtcWdyULv8PTvqCJSjJga8mm42PMv+ke2232zFN9BJg74Br3qhP+Cuf jPkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb18si4242965ejb.384.2020.07.01.12.09.53; Wed, 01 Jul 2020 12:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbgGATHe (ORCPT + 99 others); Wed, 1 Jul 2020 15:07:34 -0400 Received: from foss.arm.com ([217.140.110.172]:39848 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbgGATH3 (ORCPT ); Wed, 1 Jul 2020 15:07:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BDE04D6E; Wed, 1 Jul 2020 12:07:28 -0700 (PDT) Received: from e113632-lin.cambridge.arm.com (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BF1CB3F68F; Wed, 1 Jul 2020 12:07:27 -0700 (PDT) From: Valentin Schneider To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, morten.rasmussen@arm.com Subject: [PATCH v3 7/7] sched/topology: Use prebuilt SD flag degeneration mask Date: Wed, 1 Jul 2020 20:06:55 +0100 Message-Id: <20200701190656.10126-8-valentin.schneider@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701190656.10126-1-valentin.schneider@arm.com> References: <20200701190656.10126-1-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Leverage SD_DEGENERATE_GROUPS_MASK in sd_degenerate() and sd_degenerate_parent(). Note that this changes sd_degenerate() somewhat: I'm using the negation of SD_DEGENERATE_GROUPS_MASK as the mask of flags not requiring groups, which is equivalent to: SD_WAKE_AFFINE | SD_SERIALIZE | SD_NUMA whereas the current mask for that is simply SD_WAKE_AFFINE I played with a few toy NUMA topologies on QEMU and couldn't cause a different degeneration than what mainline does currently. If that is deemed too risky, we can go back to using SD_WAKE_AFFINE explicitly. Suggested-by: Peter Zijlstra Signed-off-by: Valentin Schneider --- kernel/sched/topology.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index fe393b295444..a135a0c99b16 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -160,22 +160,13 @@ static int sd_degenerate(struct sched_domain *sd) return 1; /* Following flags need at least 2 groups */ - if (sd->flags & (SD_BALANCE_NEWIDLE | - SD_BALANCE_WAKE | - SD_BALANCE_FORK | - SD_BALANCE_EXEC | - SD_ASYM_PACKING | - SD_SHARE_CPUCAPACITY | - SD_ASYM_CPUCAPACITY | - SD_SHARE_PKG_RESOURCES | - SD_OVERLAP | - SD_PREFER_SIBLING)) { + if (sd->flags & SD_DEGENERATE_GROUPS_MASK) { if (sd->groups != sd->groups->next) return 0; } /* Following flags don't use groups */ - if (sd->flags & (SD_WAKE_AFFINE)) + if (sd->flags & ~SD_DEGENERATE_GROUPS_MASK) return 0; return 1; @@ -194,16 +185,7 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) /* Flags needing groups don't count if only 1 group in parent */ if (parent->groups == parent->groups->next) { - pflags &= ~(SD_BALANCE_NEWIDLE | - SD_BALANCE_WAKE | - SD_BALANCE_FORK | - SD_BALANCE_EXEC | - SD_ASYM_PACKING | - SD_ASYM_CPUCAPACITY | - SD_SHARE_CPUCAPACITY | - SD_SHARE_PKG_RESOURCES | - SD_OVERLAP | - SD_PREFER_SIBLING); + pflags &= ~SD_DEGENERATE_GROUPS_MASK; if (nr_node_ids == 1) pflags &= ~SD_SERIALIZE; } -- 2.27.0