diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-04-07 08:10:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-11 08:09:32 -0400 |
commit | 60495e7760d8ee364695006af37309b0755e0e17 (patch) | |
tree | 1c842c0797a6a6b0066b18f296661fcf77cd0d0a | |
parent | 54ab4ff4316eb329d2c1acc110fbc623d2966931 (diff) |
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>
-rw-r--r-- | include/linux/sched.h | 23 | ||||
-rw-r--r-- | kernel/cpuset.c | 2 | ||||
-rw-r--r-- | kernel/sched.c | 9 |
3 files changed, 10 insertions, 24 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 09d9e02f2b61..e43e5b0ab0b5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -892,25 +892,6 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg) | |||
892 | return to_cpumask(sg->cpumask); | 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 | struct sched_domain_attr { | 895 | struct sched_domain_attr { |
915 | int relax_domain_level; | 896 | int relax_domain_level; |
916 | }; | 897 | }; |
@@ -919,6 +900,8 @@ struct sched_domain_attr { | |||
919 | .relax_domain_level = -1, \ | 900 | .relax_domain_level = -1, \ |
920 | } | 901 | } |
921 | 902 | ||
903 | extern int sched_domain_level_max; | ||
904 | |||
922 | struct sched_domain { | 905 | struct sched_domain { |
923 | /* These fields must be setup */ | 906 | /* These fields must be setup */ |
924 | struct sched_domain *parent; /* top domain must be null terminated */ | 907 | struct sched_domain *parent; /* top domain must be null terminated */ |
@@ -936,7 +919,7 @@ struct sched_domain { | |||
936 | unsigned int forkexec_idx; | 919 | unsigned int forkexec_idx; |
937 | unsigned int smt_gain; | 920 | unsigned int smt_gain; |
938 | int flags; /* See SD_* */ | 921 | int flags; /* See SD_* */ |
939 | enum sched_domain_level level; | 922 | int level; |
940 | 923 | ||
941 | /* Runtime fields. */ | 924 | /* Runtime fields. */ |
942 | unsigned long last_balance; /* init to jiffies. units in jiffies */ | 925 | unsigned long last_balance; /* init to jiffies. units in jiffies */ |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 33eee16addb8..2bb8c2e98fff 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1159,7 +1159,7 @@ int current_cpuset_is_being_rebound(void) | |||
1159 | static int update_relax_domain_level(struct cpuset *cs, s64 val) | 1159 | static int update_relax_domain_level(struct cpuset *cs, s64 val) |
1160 | { | 1160 | { |
1161 | #ifdef CONFIG_SMP | 1161 | #ifdef CONFIG_SMP |
1162 | if (val < -1 || val >= SD_LV_MAX) | 1162 | if (val < -1 || val >= sched_domain_level_max) |
1163 | return -EINVAL; | 1163 | return -EINVAL; |
1164 | #endif | 1164 | #endif |
1165 | 1165 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 3231e1997426..506cb8147c70 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6966,7 +6966,6 @@ sd_init_##type(struct sched_domain_topology_level *tl, int cpu) \ | |||
6966 | { \ | 6966 | { \ |
6967 | struct sched_domain *sd = *per_cpu_ptr(tl->data.sd, cpu); \ | 6967 | struct sched_domain *sd = *per_cpu_ptr(tl->data.sd, cpu); \ |
6968 | *sd = SD_##type##_INIT; \ | 6968 | *sd = SD_##type##_INIT; \ |
6969 | sd->level = SD_LV_##type; \ | ||
6970 | SD_INIT_NAME(sd, type); \ | 6969 | SD_INIT_NAME(sd, type); \ |
6971 | sd->private = &tl->data; \ | 6970 | sd->private = &tl->data; \ |
6972 | return sd; \ | 6971 | return sd; \ |
@@ -6988,13 +6987,14 @@ SD_INIT_FUNC(CPU) | |||
6988 | #endif | 6987 | #endif |
6989 | 6988 | ||
6990 | static int default_relax_domain_level = -1; | 6989 | static int default_relax_domain_level = -1; |
6990 | int sched_domain_level_max; | ||
6991 | 6991 | ||
6992 | static int __init setup_relax_domain_level(char *str) | 6992 | static int __init setup_relax_domain_level(char *str) |
6993 | { | 6993 | { |
6994 | unsigned long val; | 6994 | unsigned long val; |
6995 | 6995 | ||
6996 | val = simple_strtoul(str, NULL, 0); | 6996 | val = simple_strtoul(str, NULL, 0); |
6997 | if (val < SD_LV_MAX) | 6997 | if (val < sched_domain_level_max) |
6998 | default_relax_domain_level = val; | 6998 | default_relax_domain_level = val; |
6999 | 6999 | ||
7000 | return 1; | 7000 | return 1; |
@@ -7173,8 +7173,11 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl, | |||
7173 | 7173 | ||
7174 | set_domain_attribute(sd, attr); | 7174 | set_domain_attribute(sd, attr); |
7175 | cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu)); | 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 | child->parent = sd; | 7179 | child->parent = sd; |
7180 | } | ||
7178 | sd->child = child; | 7181 | sd->child = child; |
7179 | 7182 | ||
7180 | return sd; | 7183 | return sd; |