Skip to contentSkip to conversation

sched/topology: Move sd_flag_debug out of linux/sched/topology.h

PATCH Applied Valentin Schneider 5 participants 9 messages Aug 25, 2020 – Aug 27, 2020 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sched/topology: Move sd_flag_debug out of linux/sched/topology.h

Defining an array in a header imported all over the place clearly is a daft idea, that still didn't stop me from doing it.

Leave a declaration of sd_flag_debug in topology.h and move its definition to sched/debug.c.

Fixes b6e862f38672 ("sched/topology: Define and assign sched_domain flag metadata")
---
 include/linux/sched/topology.h | 9 ++++-----
 kernel/sched/debug.c           | 6 ++++++
 2 files changed, 10 insertions(+), 5 deletions(-)
include/linux/sched/topology.h +4 -5
index 2d59ca77103e..b9b0dab4d067 100644
@@ -33,14 +33,13 @@ static const unsigned int SD_DEGENERATE_GROUPS_MASK =
 #undef SD_FLAG
 
 #ifdef CONFIG_SCHED_DEBUG
-#define SD_FLAG(_name, mflags) [__##_name] = { .meta_flags = mflags, .name = #_name },
-static const struct {
+
+struct sd_flag_debug {
 	unsigned int meta_flags;
 	char *name;
-} sd_flag_debug[] = {
-#include <linux/sched/sd_flags.h>
 };
-#undef SD_FLAG
+extern const struct sd_flag_debug sd_flag_debug[];
+
 #endif
 
 #ifdef CONFIG_SCHED_SMT
kernel/sched/debug.c +6 -0
index 0655524700d2..0d7896d2a0b2 100644
@@ -245,6 +245,12 @@ 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)
 {
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 sched/topology: Move SD_DEGENERATE_GROUPS_MASK out of linux/sched/topology.h

SD_DEGENERATE_GROUPS_MASK is only useful for sched/topology.c, but still gets defined for anyone who imports topology.h, leading to a flurry of unused variable warnings.

Move it out of the header and place it next to the SD degeneration functions in sched/topology.c.

Fixes 4ee4ea443a5d ("sched/topology: Introduce SD metaflag for flags needing > 1 groups")
---
 include/linux/sched/topology.h | 7 -------
 kernel/sched/topology.c        | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/sched/topology.h +0 -7
index b9b0dab4d067..9ef7bf686a9f 100644
@@ -25,13 +25,6 @@ enum {
 };
 #undef SD_FLAG
 
-/* Generate a mask of SD flags with the SDF_NEEDS_GROUPS metaflag */
-#define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_NEEDS_GROUPS)) |
-static const unsigned int SD_DEGENERATE_GROUPS_MASK =
-#include <linux/sched/sd_flags.h>
-0;
-#undef SD_FLAG
-
 #ifdef CONFIG_SCHED_DEBUG
 
 struct sd_flag_debug {
kernel/sched/topology.c +7 -0
index 4e1260cb4b44..da3cd60e4b78 100644
@@ -154,6 +154,13 @@ static inline bool sched_debug(void)
 }
 #endif /* CONFIG_SCHED_DEBUG */
 
+/* Generate a mask of SD flags with the SDF_NEEDS_GROUPS metaflag */
+#define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_NEEDS_GROUPS)) |
+static const unsigned int SD_DEGENERATE_GROUPS_MASK =
+#include <linux/sched/sd_flags.h>
+0;
+#undef SD_FLAG
+
 static int sd_degenerate(struct sched_domain *sd)
 {
 	if (cpumask_weight(sched_domain_span(sd)) == 1)
Signature · 1 line
2.27.0
Tested-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] sched/topology: Move SD_DEGENERATE_GROUPS_MASK out of linux/sched/topology.h

Quoted 6 lines · Valentin Schneider

SD_DEGENERATE_GROUPS_MASK is only useful for sched/topology.c, but still gets defined for anyone who imports topology.h, leading to a flurry of unused variable warnings.

Move it out of the header and place it next to the SD degeneration functions in sched/topology.c.

Quoted 47 lines
Fixes 4ee4ea443a5d ("sched/topology: Introduce SD metaflag for flags needing > 1 groups")
---
 include/linux/sched/topology.h | 7 -------
 kernel/sched/topology.c        | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/sched/topology.h +0 -7
index b9b0dab4d067..9ef7bf686a9f 100644
@@ -25,13 +25,6 @@ enum {
 };
 #undef SD_FLAG
 
-/* Generate a mask of SD flags with the SDF_NEEDS_GROUPS metaflag */
-#define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_NEEDS_GROUPS)) |
-static const unsigned int SD_DEGENERATE_GROUPS_MASK =
-#include <linux/sched/sd_flags.h>
-0;
-#undef SD_FLAG
-
 #ifdef CONFIG_SCHED_DEBUG
 
 struct sd_flag_debug {
kernel/sched/topology.c +7 -0
index 4e1260cb4b44..da3cd60e4b78 100644
@@ -154,6 +154,13 @@ static inline bool sched_debug(void)
 }
 #endif /* CONFIG_SCHED_DEBUG */
 
+/* Generate a mask of SD flags with the SDF_NEEDS_GROUPS metaflag */
+#define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_NEEDS_GROUPS)) |
+static const unsigned int SD_DEGENERATE_GROUPS_MASK =
+#include <linux/sched/sd_flags.h>
+0;
+#undef SD_FLAG
+
 static int sd_degenerate(struct sched_domain *sd)
 {
 	if (cpumask_weight(sched_domain_span(sd)) == 1)
Signature · 1 line
2.27.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

[tip: sched/core] sched/topology: Move SD_DEGENERATE_GROUPS_MASK out of linux/sched/topology.h

In reply to Valentin Schneider
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:     4fc472f1214ef75e5450f207e23ff13af6eecad4
Gitweb:        https://git.kernel.org/tip/4fc472f1214ef75e5450f207e23ff13af6eecad4
Author:        Valentin Schneider <[email protected]>
AuthorDate:    Tue, 25 Aug 2020 14:32:16 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 26 Aug 2020 12:41:59 +02:00

sched/topology: Move SD_DEGENERATE_GROUPS_MASK out of linux/sched/topology.h

SD_DEGENERATE_GROUPS_MASK is only useful for sched/topology.c, but still gets defined for anyone who imports topology.h, leading to a flurry of unused variable warnings.

Move it out of the header and place it next to the SD degeneration functions in sched/topology.c.

Fixes 4ee4ea443a5d ("sched/topology: Introduce SD metaflag for flags needing > 1 groups")
---
 include/linux/sched/topology.h | 7 -------
 kernel/sched/topology.c        | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/sched/topology.h +0 -7
index b9b0dab..9ef7bf6 100644
@@ -25,13 +25,6 @@ enum {
 };
 #undef SD_FLAG
 
-/* Generate a mask of SD flags with the SDF_NEEDS_GROUPS metaflag */
-#define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_NEEDS_GROUPS)) |
-static const unsigned int SD_DEGENERATE_GROUPS_MASK =
-#include <linux/sched/sd_flags.h>
-0;
-#undef SD_FLAG
-
 #ifdef CONFIG_SCHED_DEBUG
 
 struct sd_flag_debug {
kernel/sched/topology.c +7 -0
index c674aaa..aa1676a 100644
@@ -154,6 +154,13 @@ static inline bool sched_debug(void)
 }
 #endif /* CONFIG_SCHED_DEBUG */
 
+/* Generate a mask of SD flags with the SDF_NEEDS_GROUPS metaflag */
+#define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_NEEDS_GROUPS)) |
+static const unsigned int SD_DEGENERATE_GROUPS_MASK =
+#include <linux/sched/sd_flags.h>
+0;
+#undef SD_FLAG
+
 static int sd_degenerate(struct sched_domain *sd)
 {
 	if (cpumask_weight(sched_domain_span(sd)) == 1)
Tested-by on v1 1/2
#4 lore raw
In reply to Valentin Schneider
Quoted 5 lines · Valentin Schneider

Defining an array in a header imported all over the place clearly is a daft idea, that still didn't stop me from doing it.

Leave a declaration of sd_flag_debug in topology.h and move its definition to sched/debug.c.

Quoted 51 lines
Fixes b6e862f38672 ("sched/topology: Define and assign sched_domain flag metadata")
---
 include/linux/sched/topology.h | 9 ++++-----
 kernel/sched/debug.c           | 6 ++++++
 2 files changed, 10 insertions(+), 5 deletions(-)
include/linux/sched/topology.h +4 -5
index 2d59ca77103e..b9b0dab4d067 100644
@@ -33,14 +33,13 @@ static const unsigned int SD_DEGENERATE_GROUPS_MASK =
 #undef SD_FLAG
 
 #ifdef CONFIG_SCHED_DEBUG
-#define SD_FLAG(_name, mflags) [__##_name] = { .meta_flags = mflags, .name = #_name },
-static const struct {
+
+struct sd_flag_debug {
 	unsigned int meta_flags;
 	char *name;
-} sd_flag_debug[] = {
-#include <linux/sched/sd_flags.h>
 };
-#undef SD_FLAG
+extern const struct sd_flag_debug sd_flag_debug[];
+
 #endif
 
 #ifdef CONFIG_SCHED_SMT
kernel/sched/debug.c +6 -0
index 0655524700d2..0d7896d2a0b2 100644
@@ -245,6 +245,12 @@ 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)
 {
Signature · 1 line
2.27.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
In reply to Valentin Schneider
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:     8fca9494d4b4d6b57b1398cd473feb308df656db
Gitweb:        https://git.kernel.org/tip/8fca9494d4b4d6b57b1398cd473feb308df656db
Author:        Valentin Schneider <[email protected]>
AuthorDate:    Tue, 25 Aug 2020 14:32:15 +01:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 26 Aug 2020 12:41:59 +02:00

sched/topology: Move sd_flag_debug out of linux/sched/topology.h

Defining an array in a header imported all over the place clearly is a daft idea, that still didn't stop me from doing it.

Leave a declaration of sd_flag_debug in topology.h and move its definition to sched/debug.c.

Fixes b6e862f38672 ("sched/topology: Define and assign sched_domain flag metadata")
---
 include/linux/sched/topology.h |  9 ++++-----
 kernel/sched/debug.c           |  6 ++++++
 2 files changed, 10 insertions(+), 5 deletions(-)
include/linux/sched/topology.h +4 -5
index 2d59ca7..b9b0dab 100644
@@ -33,14 +33,13 @@ static const unsigned int SD_DEGENERATE_GROUPS_MASK =
 #undef SD_FLAG
 
 #ifdef CONFIG_SCHED_DEBUG
-#define SD_FLAG(_name, mflags) [__##_name] = { .meta_flags = mflags, .name = #_name },
-static const struct {
+
+struct sd_flag_debug {
 	unsigned int meta_flags;
 	char *name;
-} sd_flag_debug[] = {
-#include <linux/sched/sd_flags.h>
 };
-#undef SD_FLAG
+extern const struct sd_flag_debug sd_flag_debug[];
+
 #endif
 
 #ifdef CONFIG_SCHED_SMT
kernel/sched/debug.c +6 -0
index 0655524..0d7896d 100644
@@ -245,6 +245,12 @@ 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)
 {
#6 lore raw
Quoted 8 lines · On Thu, Aug 27, 2020 at 10:57 AM tip-bot2 for Valentin Schneider…

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

Fixes b6e862f38672 ("sched/topology: Define and assign sched_domain flag metadata")

Hmm... I'm wondering if this bot is aware of tags given afterwards in the thread?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · On Thu, Aug 27, 2020 at 10:57 AM tip-bot2 for Valentin Schneider…

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

Quoted 8 lines
Quoted 5 lines
Fixes b6e862f38672 ("sched/topology: Define and assign sched_domain flag metadata")

Hmm... I'm wondering if this bot is aware of tags given afterwards in the thread?

Sorry, your tag came in after I'd already queued the lot.

#8 lore raw
Quoted 13 lines · On Thu, Aug 27, 2020 at 12:27 PM <[email protected]> wrote:
Quoted 11 lines · Andy Shevchenko
Quoted 8 lines · On Thu, Aug 27, 2020 at 10:57 AM tip-bot2 for Valentin Schneider…

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

Fixes b6e862f38672 ("sched/topology: Define and assign sched_domain flag metadata")
Quoted 4 lines
Quoted 2 lines

Hmm... I'm wondering if this bot is aware of tags given afterwards in the thread?

Sorry, your tag came in after I'd already queued the lot.

No problem, just was wondering!

Signature · 2 lines
With Best Regards,
Andy Shevchenko