Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp430189pxa; Wed, 12 Aug 2020 05:54:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrToauuHhPrNmy/q1EVk/TF+nhzejm7AI4cCDBLQwYGbU1f/mi5GT/5DHPNZv5YSveoiX4 X-Received: by 2002:a17:907:372:: with SMTP id rs18mr30046902ejb.146.1597236870153; Wed, 12 Aug 2020 05:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597236870; cv=none; d=google.com; s=arc-20160816; b=Ynfr6zK7xYw2MwMG0xxKcxCkmd+xh9FXVL/tmTLG+wVHJ4lGuYZmfT9rtSp3eIT0d5 uH2eiGvela3KsXY9WKNOmOF5agb5HUkSVa+LzFpsuCozUWoIc4rX1hsuNY1LLwZgcsrP 6xdjiQ/J79eXEXX6RC5UgNhmBxxkt4EK82fTZfiI0blVv3c2Y0rSME7NBUvAnTtkwLNS erbpZGTPCJWqBL6BIa4J1PfRZwxni7tNYLEZ5P6lOtxx/5HbRIJTJrORM/K1adH1wmRm TNZ4SUyOId2FiWPzWCMGWlVc2DD2GP6yoK6jSYmamDY4g7WgWguXg5RR3v+6RBx34g3Q gEqw== 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=/M7aeisfqAl//qrBfEM1e2GCq0MODRxtgPcvqWpxOnE=; b=o9hNQm/50bp/faYEvEOzXbZChmJBMHy3iVuGZ8Qa+Vv0QR2QaHk0XiMRBlQFB+guxx Z0eOwpz6swo0NgKZNF8HhDJ2BwUyrHy6PYJjQNbeHaV07785v7OA2tFsJeKU4BLPkWFA h/yYcj70YfvcqzOU3PGh6I+NhQWKkgAWeu4Lm4Zmr6wNh0OGGzSvuc2uSfKUV5bGbrEM mYt5+KnUMjOO+sR1qmA6VhgWuM8+6ZyjhA03sNtFdaBgAqfD740D/DlepigXTNsmIhBM SuE11FFtc5gwjBQR3zYY8t+JsmpJTVb4rsw0lS2iZjKzxnQsvHeDaRr6ulFObig9r7VQ ii0Q== 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 u7si1080213ejn.161.2020.08.12.05.54.07; Wed, 12 Aug 2020 05:54:30 -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 S1728009AbgHLMxY (ORCPT + 99 others); Wed, 12 Aug 2020 08:53:24 -0400 Received: from foss.arm.com ([217.140.110.172]:44530 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727936AbgHLMxS (ORCPT ); Wed, 12 Aug 2020 08:53:18 -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 3CDB712FC; Wed, 12 Aug 2020 05:53:17 -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 087053F70D; Wed, 12 Aug 2020 05:53:15 -0700 (PDT) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Dietmar Eggemann , mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, morten.rasmussen@arm.com, Quentin Perret Subject: [PATCH v5 03/17] sched/topology: Split out SD_* flags declaration to its own file Date: Wed, 12 Aug 2020 13:52:46 +0100 Message-Id: <20200812125300.11889-4-valentin.schneider@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200812125300.11889-1-valentin.schneider@arm.com> References: <20200812125300.11889-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 To associate the SD flags with some metadata, we need some more structure in the way they are declared. Rather than shove that in a free-standing macro list, move the declaration in a separate file that can be re-imported with different SD_FLAG definitions. This is inspired by what is done with the syscall table (see uapi/asm/unistd.h and sys_call_table). The value assigned to a given SD flag now depends on the order it appears in sd_flags.h. No change in functionality. Reviewed-by: Dietmar Eggemann Signed-off-by: Valentin Schneider --- include/linux/sched/sd_flags.h | 35 ++++++++++++++++++++++++++++++++++ include/linux/sched/topology.h | 26 ++++++++++++------------- 2 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 include/linux/sched/sd_flags.h diff --git a/include/linux/sched/sd_flags.h b/include/linux/sched/sd_flags.h new file mode 100644 index 000000000000..5a74751a1a83 --- /dev/null +++ b/include/linux/sched/sd_flags.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * sched-domains (multiprocessor balancing) flag declarations. + */ + +#ifndef SD_FLAG +#error "Incorrect import of SD flags definitions" +#endif + +/* Balance when about to become idle */ +SD_FLAG(SD_BALANCE_NEWIDLE) +/* Balance on exec */ +SD_FLAG(SD_BALANCE_EXEC) +/* Balance on fork, clone */ +SD_FLAG(SD_BALANCE_FORK) +/* Balance on wakeup */ +SD_FLAG(SD_BALANCE_WAKE) +/* Wake task to waking CPU */ +SD_FLAG(SD_WAKE_AFFINE) +/* Domain members have different CPU capacities */ +SD_FLAG(SD_ASYM_CPUCAPACITY) +/* Domain members share CPU capacity */ +SD_FLAG(SD_SHARE_CPUCAPACITY) +/* Domain members share CPU pkg resources */ +SD_FLAG(SD_SHARE_PKG_RESOURCES) +/* Only a single load balancing instance */ +SD_FLAG(SD_SERIALIZE) +/* Place busy groups earlier in the domain */ +SD_FLAG(SD_ASYM_PACKING) +/* Prefer to place tasks in a sibling domain */ +SD_FLAG(SD_PREFER_SIBLING) +/* sched_domains of this level overlap */ +SD_FLAG(SD_OVERLAP) +/* cross-node balancing */ +SD_FLAG(SD_NUMA) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 6ec7d7c1d1e3..3e41c0401b5f 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -11,19 +11,19 @@ */ #ifdef CONFIG_SMP -#define SD_BALANCE_NEWIDLE 0x0001 /* Balance when about to become idle */ -#define SD_BALANCE_EXEC 0x0002 /* Balance on exec */ -#define SD_BALANCE_FORK 0x0004 /* Balance on fork, clone */ -#define SD_BALANCE_WAKE 0x0008 /* Balance on wakeup */ -#define SD_WAKE_AFFINE 0x0010 /* Wake task to waking CPU */ -#define SD_ASYM_CPUCAPACITY 0x0020 /* Domain members have different CPU capacities */ -#define SD_SHARE_CPUCAPACITY 0x0040 /* Domain members share CPU capacity */ -#define SD_SHARE_PKG_RESOURCES 0x0080 /* Domain members share CPU pkg resources */ -#define SD_SERIALIZE 0x0100 /* Only a single load balancing instance */ -#define SD_ASYM_PACKING 0x0200 /* Place busy groups earlier in the domain */ -#define SD_PREFER_SIBLING 0x0400 /* Prefer to place tasks in a sibling domain */ -#define SD_OVERLAP 0x0800 /* sched_domains of this level overlap */ -#define SD_NUMA 0x1000 /* cross-node balancing */ +/* Generate SD flag indexes */ +#define SD_FLAG(name) __##name, +enum { + #include + __SD_FLAG_CNT, +}; +#undef SD_FLAG +/* Generate SD flag bits */ +#define SD_FLAG(name) name = 1 << __##name, +enum { + #include +}; +#undef SD_FLAG #ifdef CONFIG_SCHED_SMT static inline int cpu_smt_flags(void) -- 2.27.0