[RFC v2 PATCH 05/11] sched: add a name to sched_domain_topology_info

From: dietmar . eggemann
Date: Mon Jan 20 2014 - 07:43:19 EST


From: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>

With this patch, an arbitrary name for a sd level has to be specified in
the topology info table. This feature is still only active if
CONFIG_SCHED_DEBUG is set.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
---
include/linux/sched.h | 11 ++++++++++-
kernel/sched/core.c | 23 +++++++----------------
2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index bf2ee608af67..f79a0d5041fb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2784,9 +2784,18 @@ typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);

struct sched_domain_topology_info {
sched_domain_mask_f mask;
- int flags;
+ int flags;
+#ifdef CONFIG_SCHED_DEBUG
+ char *name;
+#endif
};

+#ifdef CONFIG_SCHED_DEBUG
+# define SD_NAME(n) .name = #n
+#else
+# define SD_NAME(n)
+#endif
+
extern void
set_sd_topology_info(struct sched_domain_topology_info *ti, unsigned int s);

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 90aa7c3d3a00..798a4d2c9d7b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5243,12 +5243,6 @@ int __weak arch_sd_sibling_asym_packing(void)
* Non-inlined to reduce accumulated stack pressure in build_sched_domains()
*/

-#ifdef CONFIG_SCHED_DEBUG
-# define SD_INIT_NAME(sd, type) sd->name = #type
-#else
-# define SD_INIT_NAME(sd, type) do { } while (0)
-#endif
-
static int default_relax_domain_level = -1;
int sched_domain_level_max;

@@ -5341,15 +5335,15 @@ static void claim_allocations(int cpu, struct sched_domain *sd)
*/
static struct sched_domain_topology_info default_topology_info[] = {
#ifdef CONFIG_SCHED_SMT
- { cpu_smt_mask, SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES },
+ { cpu_smt_mask, SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES, SD_NAME(SIBLING) },
#endif
#ifdef CONFIG_SCHED_MC
- { cpu_coregroup_mask, SD_SHARE_PKG_RESOURCES },
+ { cpu_coregroup_mask, SD_SHARE_PKG_RESOURCES, SD_NAME(MC) },
#endif
#ifdef CONFIG_SCHED_BOOK
- { cpu_book_mask, },
+ { cpu_book_mask, SD_NAME(BOOK) },
#endif
- { cpu_cpu_mask, },
+ { cpu_cpu_mask, SD_NAME(CPU) },
};

static struct sched_domain_topology_level *sched_domain_topology;
@@ -5676,6 +5670,9 @@ sd_init(struct sched_domain_topology_level *tl, int cpu)

.last_balance = jiffies,
.balance_interval = sd_weight,
+#ifdef CONFIG_SCHED_DEBUG
+ .name = tl->info.name,
+#endif
};

/*
@@ -5693,13 +5690,9 @@ sd_init(struct sched_domain_topology_level *tl, int cpu)
* setup.
*/
sd->flags |= arch_sd_sibling_asym_packing();
-
- SD_INIT_NAME(sd, SMT);
} else if (sd->flags & SD_SHARE_PKG_RESOURCES) {
sd->cache_nice_tries = 1;
sd->busy_idx = 2;
-
- SD_INIT_NAME(sd, MC);
#ifdef CONFIG_NUMA
} else if (sd->flags & SD_NUMA) {
sd->busy_factor = 32,
@@ -5719,8 +5712,6 @@ sd_init(struct sched_domain_topology_level *tl, int cpu)
sd->busy_idx = 2;
sd->idle_idx = 1;
sd->flags |= SD_PREFER_SIBLING;
-
- SD_INIT_NAME(sd, CPU);
}

sd->private = &tl->data;
--
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/