aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSiddha, Suresh B <suresh.b.siddha@intel.com>2006-10-03 04:14:09 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:06 -0400
commit89c4710ee9bbbefe6a4d469d9f36266a92c275c5 (patch)
treef84fe28e48bbda210f01f22ae0065f7ed1fcc5e1 /include/linux
parent1a84887080dc15f048db7c3a643e98f1435790d6 (diff)
[PATCH] sched: cleanup sched_group cpu_power setup
Up to now sched group's cpu_power for each sched domain is initialized independently. This made the setup code ugly as the new sched domains are getting added. Make the sched group cpu_power setup code generic, by using domain child field and new domain flag in sched_domain. For most of the sched domains(except NUMA), sched group's cpu_power is now computed generically using the domain properties of itself and of the child domain. sched groups in NUMA domains are setup little differently and hence they don't use this generic mechanism. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Acked-by: Ingo Molnar <mingo@elte.hu> Acked-by: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sched.h12
-rw-r--r--include/linux/topology.h43
2 files changed, 43 insertions, 12 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8e26c9069f15..331f4502e92b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -625,9 +625,17 @@ enum idle_type
625#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ 625#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */
626#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ 626#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */
627#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ 627#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */
628#define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */
628 629
629#define BALANCE_FOR_POWER ((sched_mc_power_savings || sched_smt_power_savings) \ 630#define BALANCE_FOR_MC_POWER \
630 ? SD_POWERSAVINGS_BALANCE : 0) 631 (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0)
632
633#define BALANCE_FOR_PKG_POWER \
634 ((sched_mc_power_savings || sched_smt_power_savings) ? \
635 SD_POWERSAVINGS_BALANCE : 0)
636
637#define test_sd_parent(sd, flag) ((sd->parent && \
638 (sd->parent->flags & flag)) ? 1 : 0)
631 639
632 640
633struct sched_group { 641struct sched_group {
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 486bec23f986..da508d1998e4 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -115,6 +115,38 @@
115#endif 115#endif
116#endif /* CONFIG_SCHED_SMT */ 116#endif /* CONFIG_SCHED_SMT */
117 117
118#ifdef CONFIG_SCHED_MC
119/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
120#ifndef SD_MC_INIT
121#define SD_MC_INIT (struct sched_domain) { \
122 .span = CPU_MASK_NONE, \
123 .parent = NULL, \
124 .child = NULL, \
125 .groups = NULL, \
126 .min_interval = 1, \
127 .max_interval = 4, \
128 .busy_factor = 64, \
129 .imbalance_pct = 125, \
130 .cache_nice_tries = 1, \
131 .per_cpu_gain = 100, \
132 .busy_idx = 2, \
133 .idle_idx = 1, \
134 .newidle_idx = 2, \
135 .wake_idx = 1, \
136 .forkexec_idx = 1, \
137 .flags = SD_LOAD_BALANCE \
138 | SD_BALANCE_NEWIDLE \
139 | SD_BALANCE_EXEC \
140 | SD_WAKE_AFFINE \
141 | SD_SHARE_PKG_RESOURCES\
142 | BALANCE_FOR_MC_POWER, \
143 .last_balance = jiffies, \
144 .balance_interval = 1, \
145 .nr_balance_failed = 0, \
146}
147#endif
148#endif /* CONFIG_SCHED_MC */
149
118/* Common values for CPUs */ 150/* Common values for CPUs */
119#ifndef SD_CPU_INIT 151#ifndef SD_CPU_INIT
120#define SD_CPU_INIT (struct sched_domain) { \ 152#define SD_CPU_INIT (struct sched_domain) { \
@@ -137,7 +169,7 @@
137 | SD_BALANCE_NEWIDLE \ 169 | SD_BALANCE_NEWIDLE \
138 | SD_BALANCE_EXEC \ 170 | SD_BALANCE_EXEC \
139 | SD_WAKE_AFFINE \ 171 | SD_WAKE_AFFINE \
140 | BALANCE_FOR_POWER, \ 172 | BALANCE_FOR_PKG_POWER,\
141 .last_balance = jiffies, \ 173 .last_balance = jiffies, \
142 .balance_interval = 1, \ 174 .balance_interval = 1, \
143 .nr_balance_failed = 0, \ 175 .nr_balance_failed = 0, \
@@ -168,15 +200,6 @@
168 .nr_balance_failed = 0, \ 200 .nr_balance_failed = 0, \
169} 201}
170 202
171#ifdef CONFIG_SCHED_MC
172#ifndef SD_MC_INIT
173/* for now its same as SD_CPU_INIT.
174 * TBD: Tune Domain parameters!
175 */
176#define SD_MC_INIT SD_CPU_INIT
177#endif
178#endif
179
180#ifdef CONFIG_NUMA 203#ifdef CONFIG_NUMA
181#ifndef SD_NODE_INIT 204#ifndef SD_NODE_INIT
182#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!! 205#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!