Skip to contentSkip to conversation

sched/topology: Move sd_flag_debug out of #ifdef CONFIG_SYSCTL

PATCH Applied Valentin Schneider 2 participants 2 messages Sep 8, 2020 – Sep 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/topology: Move sd_flag_debug out of #ifdef CONFIG_SYSCTL

The last sd_flag_debug shuffle inadvertently moved its definition within an #ifdef CONFIG_SYSCTL region. While CONFIG_SYSCTL is indeed required to produce the sched domain ctl interface (which uses sd_flag_debug to output flag names), it isn't required to run any assertion on the sched_domain hierarchy itself.

Move the definition of sd_flag_debug to a CONFIG_SCHED_DEBUG region of topology.c.

Now at long last we have:
o sd_flag_debug declared in include/linux/sched/topology.h iff CONFIG_SCHED_DEBUG=y
o sd_flag_debug defined in kernel/sched/topology.c, conditioned by:
o CONFIG_SCHED_DEBUG, with an explicit #ifdef block
o CONFIG_SMP, as a requirement to compile topology.c

With this change, all symbols pertaining to SD flag metadata (with the exception of __SD_FLAG_CNT) are now defined exclusively within topology.c

Fixes 8fca9494d4b4 ("sched/topology: Move sd_flag_debug out of linux/sched/topology.h")

---
@Randy I didn't keep your Acked-by given that this is a slightly different shuffle.

---
 kernel/sched/debug.c    | 6 ------
 kernel/sched/topology.c | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
kernel/sched/debug.c +0 -6
index 0d7896d2a0b2..0655524700d2 100644
@@ -245,12 +245,6 @@ set_table_entry(struct ctl_table *entry,
 	entry->proc_handler = proc_handler;
 }
 
-#define SD_FLAG(_name, mflags) [__##_name] = { .meta_flags = mflags, .name = #_name },
-const struct sd_flag_debug sd_flag_debug[] = {
-#include <linux/sched/sd_flags.h>
-};
-#undef SD_FLAG
-
 static int sd_ctl_doflags(struct ctl_table *table, int write,
 			  void *buffer, size_t *lenp, loff_t *ppos)
 {
kernel/sched/topology.c +6 -0
index da3cd60e4b78..55c453d140e9 100644
@@ -25,6 +25,12 @@ static inline bool sched_debug(void)
 	return sched_debug_enabled;
 }
 
+#define SD_FLAG(_name, mflags) [__##_name] = { .meta_flags = mflags, .name = #_name },
+const struct sd_flag_debug sd_flag_debug[] = {
+#include <linux/sched/sd_flags.h>
+};
+#undef SD_FLAG
+
 static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 				  struct cpumask *groupmask)
 {
Signature · 1 line
2.27.0
#1 lore raw
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     848785df48835eefebe0c4eb5da7690690b0a8b7
Gitweb:        https://git.kernel.org/tip/848785df48835eefebe0c4eb5da7690690b0a8b7
Author:        Valentin Schneider <[email protected]>
AuthorDate:    Tue, 08 Sep 2020 19:49:56 +01:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Wed, 09 Sep 2020 10:09:03 +02:00

sched/topology: Move sd_flag_debug out of #ifdef CONFIG_SYSCTL

The last sd_flag_debug shuffle inadvertently moved its definition within an #ifdef CONFIG_SYSCTL region. While CONFIG_SYSCTL is indeed required to produce the sched domain ctl interface (which uses sd_flag_debug to output flag names), it isn't required to run any assertion on the sched_domain hierarchy itself.

Move the definition of sd_flag_debug to a CONFIG_SCHED_DEBUG region of topology.c.

Now at long last we have:

- sd_flag_debug declared in include/linux/sched/topology.h iff CONFIG_SCHED_DEBUG=y
- sd_flag_debug defined in kernel/sched/topology.c, conditioned by:
- CONFIG_SCHED_DEBUG, with an explicit #ifdef block
- CONFIG_SMP, as a requirement to compile topology.c

With this change, all symbols pertaining to SD flag metadata (with the exception of __SD_FLAG_CNT) are now defined exclusively within topology.c

Fixes 8fca9494d4b4 ("sched/topology: Move sd_flag_debug out of linux/sched/topology.h")
---
 kernel/sched/debug.c    | 6 ------
 kernel/sched/topology.c | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
kernel/sched/debug.c +0 -6
index 0d7896d..0655524 100644
@@ -245,12 +245,6 @@ set_table_entry(struct ctl_table *entry,
 	entry->proc_handler = proc_handler;
 }
 
-#define SD_FLAG(_name, mflags) [__##_name] = { .meta_flags = mflags, .name = #_name },
-const struct sd_flag_debug sd_flag_debug[] = {
-#include <linux/sched/sd_flags.h>
-};
-#undef SD_FLAG
-
 static int sd_ctl_doflags(struct ctl_table *table, int write,
 			  void *buffer, size_t *lenp, loff_t *ppos)
 {
kernel/sched/topology.c +6 -0
index aa1676a..249bec7 100644
@@ -25,6 +25,12 @@ static inline bool sched_debug(void)
 	return sched_debug_enabled;
 }
 
+#define SD_FLAG(_name, mflags) [__##_name] = { .meta_flags = mflags, .name = #_name },
+const struct sd_flag_debug sd_flag_debug[] = {
+#include <linux/sched/sd_flags.h>
+};
+#undef SD_FLAG
+
 static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 				  struct cpumask *groupmask)
 {