Commit 60495e7760d8ee364695006af37309b0755e0e17

Authored by Peter Zijlstra
Committed by Ingo Molnar
1 parent 54ab4ff431

sched: Dynamic sched_domain::level

Remove the SD_LV_ enum and use dynamic level assignments.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20110407122942.969433965@chello.nl
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 3 changed files with 10 additions and 24 deletions Side-by-side Diff

include/linux/sched.h
... ... @@ -892,25 +892,6 @@
892 892 return to_cpumask(sg->cpumask);
893 893 }
894 894  
895   -enum sched_domain_level {
896   - SD_LV_NONE = 0,
897   -#ifdef CONFIG_SCHED_SMT
898   - SD_LV_SIBLING,
899   -#endif
900   -#ifdef CONFIG_SCHED_MC
901   - SD_LV_MC,
902   -#endif
903   -#ifdef CONFIG_SCHED_BOOK
904   - SD_LV_BOOK,
905   -#endif
906   - SD_LV_CPU,
907   -#ifdef CONFIG_NUMA
908   - SD_LV_NODE,
909   - SD_LV_ALLNODES,
910   -#endif
911   - SD_LV_MAX
912   -};
913   -
914 895 struct sched_domain_attr {
915 896 int relax_domain_level;
916 897 };
... ... @@ -919,6 +900,8 @@
919 900 .relax_domain_level = -1, \
920 901 }
921 902  
  903 +extern int sched_domain_level_max;
  904 +
922 905 struct sched_domain {
923 906 /* These fields must be setup */
924 907 struct sched_domain *parent; /* top domain must be null terminated */
... ... @@ -936,7 +919,7 @@
936 919 unsigned int forkexec_idx;
937 920 unsigned int smt_gain;
938 921 int flags; /* See SD_* */
939   - enum sched_domain_level level;
  922 + int level;
940 923  
941 924 /* Runtime fields. */
942 925 unsigned long last_balance; /* init to jiffies. units in jiffies */
... ... @@ -1159,7 +1159,7 @@
1159 1159 static int update_relax_domain_level(struct cpuset *cs, s64 val)
1160 1160 {
1161 1161 #ifdef CONFIG_SMP
1162   - if (val < -1 || val >= SD_LV_MAX)
  1162 + if (val < -1 || val >= sched_domain_level_max)
1163 1163 return -EINVAL;
1164 1164 #endif
1165 1165  
... ... @@ -6966,7 +6966,6 @@
6966 6966 { \
6967 6967 struct sched_domain *sd = *per_cpu_ptr(tl->data.sd, cpu); \
6968 6968 *sd = SD_##type##_INIT; \
6969   - sd->level = SD_LV_##type; \
6970 6969 SD_INIT_NAME(sd, type); \
6971 6970 sd->private = &tl->data; \
6972 6971 return sd; \
6973 6972  
... ... @@ -6988,13 +6987,14 @@
6988 6987 #endif
6989 6988  
6990 6989 static int default_relax_domain_level = -1;
  6990 +int sched_domain_level_max;
6991 6991  
6992 6992 static int __init setup_relax_domain_level(char *str)
6993 6993 {
6994 6994 unsigned long val;
6995 6995  
6996 6996 val = simple_strtoul(str, NULL, 0);
6997   - if (val < SD_LV_MAX)
  6997 + if (val < sched_domain_level_max)
6998 6998 default_relax_domain_level = val;
6999 6999  
7000 7000 return 1;
7001 7001  
... ... @@ -7173,8 +7173,11 @@
7173 7173  
7174 7174 set_domain_attribute(sd, attr);
7175 7175 cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
7176   - if (child)
  7176 + if (child) {
  7177 + sd->level = child->level + 1;
  7178 + sched_domain_level_max = max(sched_domain_level_max, sd->level);
7177 7179 child->parent = sd;
  7180 + }
7178 7181 sd->child = child;
7179 7182  
7180 7183 return sd;