Преглед на файлове

sched debug: add name to sched_domain sysctl entries

add /proc/sys/kernel/sched_domain/cpu0/domain0/name, to make
it easier to see which specific scheduler domain remained at
that entry.

Since we process the scheduler domain tree and
simplify it, it's not always immediately clear during debugging
which domain came from where.

depends on CONFIG_SCHED_DEBUG=y.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Ingo Molnar преди 16 години
родител
ревизия
a5d8c3483a
променени са 2 файла, в които са добавени 15 реда и са изтрити 2 реда
  1. 3 0
      include/linux/sched.h
  2. 12 2
      kernel/sched.c

+ 3 - 0
include/linux/sched.h

@@ -824,6 +824,9 @@ struct sched_domain {
 	unsigned int ttwu_move_affine;
 	unsigned int ttwu_move_affine;
 	unsigned int ttwu_move_balance;
 	unsigned int ttwu_move_balance;
 #endif
 #endif
+#ifdef CONFIG_SCHED_DEBUG
+	char *name;
+#endif
 };
 };
 
 
 extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
 extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,

+ 12 - 2
kernel/sched.c

@@ -6351,7 +6351,7 @@ set_table_entry(struct ctl_table *entry,
 static struct ctl_table *
 static struct ctl_table *
 sd_alloc_ctl_domain_table(struct sched_domain *sd)
 sd_alloc_ctl_domain_table(struct sched_domain *sd)
 {
 {
-	struct ctl_table *table = sd_alloc_ctl_entry(12);
+	struct ctl_table *table = sd_alloc_ctl_entry(13);
 
 
 	if (table == NULL)
 	if (table == NULL)
 		return NULL;
 		return NULL;
@@ -6379,7 +6379,9 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
 		sizeof(int), 0644, proc_dointvec_minmax);
 		sizeof(int), 0644, proc_dointvec_minmax);
 	set_table_entry(&table[10], "flags", &sd->flags,
 	set_table_entry(&table[10], "flags", &sd->flags,
 		sizeof(int), 0644, proc_dointvec_minmax);
 		sizeof(int), 0644, proc_dointvec_minmax);
-	/* &table[11] is terminator */
+	set_table_entry(&table[11], "name", sd->name,
+		CORENAME_MAX_SIZE, 0444, proc_dostring);
+	/* &table[12] is terminator */
 
 
 	return table;
 	return table;
 }
 }
@@ -7263,13 +7265,21 @@ static void init_sched_groups_power(int cpu, struct sched_domain *sd)
  * Non-inlined to reduce accumulated stack pressure in build_sched_domains()
  * 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
+
 #define	SD_INIT(sd, type)	sd_init_##type(sd)
 #define	SD_INIT(sd, type)	sd_init_##type(sd)
+
 #define SD_INIT_FUNC(type)	\
 #define SD_INIT_FUNC(type)	\
 static noinline void sd_init_##type(struct sched_domain *sd)	\
 static noinline void sd_init_##type(struct sched_domain *sd)	\
 {								\
 {								\
 	memset(sd, 0, sizeof(*sd));				\
 	memset(sd, 0, sizeof(*sd));				\
 	*sd = SD_##type##_INIT;					\
 	*sd = SD_##type##_INIT;					\
 	sd->level = SD_LV_##type;				\
 	sd->level = SD_LV_##type;				\
+	SD_INIT_NAME(sd, type);					\
 }
 }
 
 
 SD_INIT_FUNC(CPU)
 SD_INIT_FUNC(CPU)