diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-09-03 07:16:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-15 10:01:07 -0400 |
commit | 78e7ed53c9f42f04f9401ada6f7047db60781676 (patch) | |
tree | 24f45333ce4479b27c96b425c7d09c080a26609f | |
parent | d7c33c4930f569caf6b2ece597432853c4151a45 (diff) |
sched: Tweak wake_idx
When merging select_task_rq_fair() and sched_balance_self() we lost
the use of wake_idx, restore that and set them to 0 to make wake
balancing more aggressive.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/ia64/include/asm/topology.h | 5 | ||||
-rw-r--r-- | arch/powerpc/include/asm/topology.h | 3 | ||||
-rw-r--r-- | arch/sh/include/asm/topology.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/topology_64.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/topology.h | 2 | ||||
-rw-r--r-- | include/linux/topology.h | 4 | ||||
-rw-r--r-- | kernel/sched_fair.c | 21 |
7 files changed, 28 insertions, 11 deletions
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h index cf6053b226c3..47f3c51d5e27 100644 --- a/arch/ia64/include/asm/topology.h +++ b/arch/ia64/include/asm/topology.h | |||
@@ -62,11 +62,12 @@ void build_cpu_to_node_map(void); | |||
62 | .busy_idx = 2, \ | 62 | .busy_idx = 2, \ |
63 | .idle_idx = 1, \ | 63 | .idle_idx = 1, \ |
64 | .newidle_idx = 2, \ | 64 | .newidle_idx = 2, \ |
65 | .wake_idx = 1, \ | 65 | .wake_idx = 0, \ |
66 | .forkexec_idx = 1, \ | 66 | .forkexec_idx = 1, \ |
67 | .flags = SD_LOAD_BALANCE \ | 67 | .flags = SD_LOAD_BALANCE \ |
68 | | SD_BALANCE_NEWIDLE \ | 68 | | SD_BALANCE_NEWIDLE \ |
69 | | SD_BALANCE_EXEC \ | 69 | | SD_BALANCE_EXEC \ |
70 | | SD_BALANCE_FORK \ | ||
70 | | SD_BALANCE_WAKE \ | 71 | | SD_BALANCE_WAKE \ |
71 | | SD_WAKE_AFFINE, \ | 72 | | SD_WAKE_AFFINE, \ |
72 | .last_balance = jiffies, \ | 73 | .last_balance = jiffies, \ |
@@ -87,7 +88,7 @@ void build_cpu_to_node_map(void); | |||
87 | .busy_idx = 3, \ | 88 | .busy_idx = 3, \ |
88 | .idle_idx = 2, \ | 89 | .idle_idx = 2, \ |
89 | .newidle_idx = 2, \ | 90 | .newidle_idx = 2, \ |
90 | .wake_idx = 1, \ | 91 | .wake_idx = 0, \ |
91 | .forkexec_idx = 1, \ | 92 | .forkexec_idx = 1, \ |
92 | .flags = SD_LOAD_BALANCE \ | 93 | .flags = SD_LOAD_BALANCE \ |
93 | | SD_BALANCE_EXEC \ | 94 | | SD_BALANCE_EXEC \ |
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h index c6343313ff59..a6b220ab56db 100644 --- a/arch/powerpc/include/asm/topology.h +++ b/arch/powerpc/include/asm/topology.h | |||
@@ -58,9 +58,10 @@ static inline int pcibus_to_node(struct pci_bus *bus) | |||
58 | .busy_idx = 3, \ | 58 | .busy_idx = 3, \ |
59 | .idle_idx = 1, \ | 59 | .idle_idx = 1, \ |
60 | .newidle_idx = 2, \ | 60 | .newidle_idx = 2, \ |
61 | .wake_idx = 1, \ | 61 | .wake_idx = 0, \ |
62 | .flags = SD_LOAD_BALANCE \ | 62 | .flags = SD_LOAD_BALANCE \ |
63 | | SD_BALANCE_EXEC \ | 63 | | SD_BALANCE_EXEC \ |
64 | | SD_BALANCE_FORK \ | ||
64 | | SD_BALANCE_NEWIDLE \ | 65 | | SD_BALANCE_NEWIDLE \ |
65 | | SD_BALANCE_WAKE \ | 66 | | SD_BALANCE_WAKE \ |
66 | | SD_SERIALIZE, \ | 67 | | SD_SERIALIZE, \ |
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h index dc1531e2f25f..9054e5c0ad54 100644 --- a/arch/sh/include/asm/topology.h +++ b/arch/sh/include/asm/topology.h | |||
@@ -16,7 +16,7 @@ | |||
16 | .busy_idx = 3, \ | 16 | .busy_idx = 3, \ |
17 | .idle_idx = 2, \ | 17 | .idle_idx = 2, \ |
18 | .newidle_idx = 2, \ | 18 | .newidle_idx = 2, \ |
19 | .wake_idx = 1, \ | 19 | .wake_idx = 0, \ |
20 | .forkexec_idx = 1, \ | 20 | .forkexec_idx = 1, \ |
21 | .flags = SD_LOAD_BALANCE \ | 21 | .flags = SD_LOAD_BALANCE \ |
22 | | SD_BALANCE_FORK \ | 22 | | SD_BALANCE_FORK \ |
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h index 1d091abd2d13..bc3a0930ed64 100644 --- a/arch/sparc/include/asm/topology_64.h +++ b/arch/sparc/include/asm/topology_64.h | |||
@@ -52,7 +52,7 @@ static inline int pcibus_to_node(struct pci_bus *pbus) | |||
52 | .busy_idx = 3, \ | 52 | .busy_idx = 3, \ |
53 | .idle_idx = 2, \ | 53 | .idle_idx = 2, \ |
54 | .newidle_idx = 0, \ | 54 | .newidle_idx = 0, \ |
55 | .wake_idx = 1, \ | 55 | .wake_idx = 0, \ |
56 | .forkexec_idx = 1, \ | 56 | .forkexec_idx = 1, \ |
57 | .flags = SD_LOAD_BALANCE \ | 57 | .flags = SD_LOAD_BALANCE \ |
58 | | SD_BALANCE_FORK \ | 58 | | SD_BALANCE_FORK \ |
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 966d58dc6274..4b1b335097b5 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -138,7 +138,7 @@ extern unsigned long node_remap_size[]; | |||
138 | .busy_idx = 3, \ | 138 | .busy_idx = 3, \ |
139 | .idle_idx = SD_IDLE_IDX, \ | 139 | .idle_idx = SD_IDLE_IDX, \ |
140 | .newidle_idx = SD_NEWIDLE_IDX, \ | 140 | .newidle_idx = SD_NEWIDLE_IDX, \ |
141 | .wake_idx = 1, \ | 141 | .wake_idx = 0, \ |
142 | .forkexec_idx = SD_FORKEXEC_IDX, \ | 142 | .forkexec_idx = SD_FORKEXEC_IDX, \ |
143 | \ | 143 | \ |
144 | .flags = 1*SD_LOAD_BALANCE \ | 144 | .flags = 1*SD_LOAD_BALANCE \ |
diff --git a/include/linux/topology.h b/include/linux/topology.h index 6a8cd15555bb..fef57040a4e2 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -120,7 +120,7 @@ int arch_update_cpu_topology(void); | |||
120 | .imbalance_pct = 125, \ | 120 | .imbalance_pct = 125, \ |
121 | .cache_nice_tries = 1, \ | 121 | .cache_nice_tries = 1, \ |
122 | .busy_idx = 2, \ | 122 | .busy_idx = 2, \ |
123 | .wake_idx = 1, \ | 123 | .wake_idx = 0, \ |
124 | .forkexec_idx = 1, \ | 124 | .forkexec_idx = 1, \ |
125 | \ | 125 | \ |
126 | .flags = 1*SD_LOAD_BALANCE \ | 126 | .flags = 1*SD_LOAD_BALANCE \ |
@@ -152,7 +152,7 @@ int arch_update_cpu_topology(void); | |||
152 | .busy_idx = 2, \ | 152 | .busy_idx = 2, \ |
153 | .idle_idx = 1, \ | 153 | .idle_idx = 1, \ |
154 | .newidle_idx = 2, \ | 154 | .newidle_idx = 2, \ |
155 | .wake_idx = 1, \ | 155 | .wake_idx = 0, \ |
156 | .forkexec_idx = 1, \ | 156 | .forkexec_idx = 1, \ |
157 | \ | 157 | \ |
158 | .flags = 1*SD_LOAD_BALANCE \ | 158 | .flags = 1*SD_LOAD_BALANCE \ |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 8b3eddbcf9a4..19593568031a 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -1232,12 +1232,27 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) | |||
1232 | * domain. | 1232 | * domain. |
1233 | */ | 1233 | */ |
1234 | static struct sched_group * | 1234 | static struct sched_group * |
1235 | find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu) | 1235 | find_idlest_group(struct sched_domain *sd, struct task_struct *p, |
1236 | int this_cpu, int flag) | ||
1236 | { | 1237 | { |
1237 | struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups; | 1238 | struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups; |
1238 | unsigned long min_load = ULONG_MAX, this_load = 0; | 1239 | unsigned long min_load = ULONG_MAX, this_load = 0; |
1239 | int load_idx = sd->forkexec_idx; | ||
1240 | int imbalance = 100 + (sd->imbalance_pct-100)/2; | 1240 | int imbalance = 100 + (sd->imbalance_pct-100)/2; |
1241 | int load_idx = 0; | ||
1242 | |||
1243 | switch (flag) { | ||
1244 | case SD_BALANCE_FORK: | ||
1245 | case SD_BALANCE_EXEC: | ||
1246 | load_idx = sd->forkexec_idx; | ||
1247 | break; | ||
1248 | |||
1249 | case SD_BALANCE_WAKE: | ||
1250 | load_idx = sd->wake_idx; | ||
1251 | break; | ||
1252 | |||
1253 | default: | ||
1254 | break; | ||
1255 | } | ||
1241 | 1256 | ||
1242 | do { | 1257 | do { |
1243 | unsigned long load, avg_load; | 1258 | unsigned long load, avg_load; |
@@ -1392,7 +1407,7 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync) | |||
1392 | continue; | 1407 | continue; |
1393 | } | 1408 | } |
1394 | 1409 | ||
1395 | group = find_idlest_group(sd, p, cpu); | 1410 | group = find_idlest_group(sd, p, cpu, flag); |
1396 | if (!group) { | 1411 | if (!group) { |
1397 | sd = sd->child; | 1412 | sd = sd->child; |
1398 | continue; | 1413 | continue; |