diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-09-10 07:50:02 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-15 10:01:05 -0400 |
commit | c88d5910890ad35af283344417891344604f0438 (patch) | |
tree | 4e2025d569c3e03a7ec5163f0a9bc159114ee14e /include/linux | |
parent | e9c8431185d6c406887190519f6dbdd112641686 (diff) |
sched: Merge select_task_rq_fair() and sched_balance_self()
The problem with wake_idle() is that is doesn't respect things like
cpu_power, which means it doesn't deal well with SMT nor the recent
RT interaction.
To cure this, it needs to do what sched_balance_self() does, which
leads to the possibility of merging select_task_rq_fair() and
sched_balance_self().
Modify sched_balance_self() to:
- update_shares() when walking up the domain tree,
(it only called it for the top domain, but it should
have done this anyway), which allows us to remove
this ugly bit from try_to_wake_up().
- do wake_affine() on the smallest domain that contains
both this (the waking) and the prev (the wakee) cpu for
WAKE invocations.
Then use the top-down balance steps it had to replace wake_idle().
This leads to the dissapearance of SD_WAKE_BALANCE and
SD_WAKE_IDLE_FAR, with SD_WAKE_IDLE replaced with SD_BALANCE_WAKE.
SD_WAKE_AFFINE needs SD_BALANCE_WAKE to be effective.
Touch all topology bits to replace the old with new SD flags --
platforms might need re-tuning, enabling SD_BALANCE_WAKE
conditionally on a NUMA distance seems like a good additional
feature, magny-core and small nehalem systems would want this
enabled, systems with slow interconnects would not.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sched.h | 7 | ||||
-rw-r--r-- | include/linux/topology.h | 16 |
2 files changed, 7 insertions, 16 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 3b0ca66bd6ce..c30bf3d516d1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -803,16 +803,15 @@ enum cpu_idle_type { | |||
803 | #define SD_BALANCE_NEWIDLE 0x0002 /* Balance when about to become idle */ | 803 | #define SD_BALANCE_NEWIDLE 0x0002 /* Balance when about to become idle */ |
804 | #define SD_BALANCE_EXEC 0x0004 /* Balance on exec */ | 804 | #define SD_BALANCE_EXEC 0x0004 /* Balance on exec */ |
805 | #define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */ | 805 | #define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */ |
806 | #define SD_WAKE_IDLE 0x0010 /* Wake to idle CPU on task wakeup */ | 806 | #define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */ |
807 | #define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ | 807 | #define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ |
808 | #define SD_WAKE_BALANCE 0x0040 /* Perform balancing at task wakeup */ | 808 | |
809 | #define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ | 809 | #define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ |
810 | #define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */ | 810 | #define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */ |
811 | #define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ | 811 | #define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ |
812 | #define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ | 812 | #define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ |
813 | #define SD_WAKE_IDLE_FAR 0x0800 /* Gain latency sacrificing cache hit */ | 813 | |
814 | #define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ | 814 | #define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ |
815 | #define SD_BALANCE_WAKE 0x2000 /* Balance on wakeup */ | ||
816 | 815 | ||
817 | enum powersavings_balance_level { | 816 | enum powersavings_balance_level { |
818 | POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */ | 817 | POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */ |
diff --git a/include/linux/topology.h b/include/linux/topology.h index 85e8cf7d393c..6a8cd15555bb 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -95,14 +95,12 @@ int arch_update_cpu_topology(void); | |||
95 | | 1*SD_BALANCE_NEWIDLE \ | 95 | | 1*SD_BALANCE_NEWIDLE \ |
96 | | 1*SD_BALANCE_EXEC \ | 96 | | 1*SD_BALANCE_EXEC \ |
97 | | 1*SD_BALANCE_FORK \ | 97 | | 1*SD_BALANCE_FORK \ |
98 | | 0*SD_WAKE_IDLE \ | 98 | | 1*SD_BALANCE_WAKE \ |
99 | | 1*SD_WAKE_AFFINE \ | 99 | | 1*SD_WAKE_AFFINE \ |
100 | | 1*SD_WAKE_BALANCE \ | ||
101 | | 1*SD_SHARE_CPUPOWER \ | 100 | | 1*SD_SHARE_CPUPOWER \ |
102 | | 0*SD_POWERSAVINGS_BALANCE \ | 101 | | 0*SD_POWERSAVINGS_BALANCE \ |
103 | | 0*SD_SHARE_PKG_RESOURCES \ | 102 | | 0*SD_SHARE_PKG_RESOURCES \ |
104 | | 0*SD_SERIALIZE \ | 103 | | 0*SD_SERIALIZE \ |
105 | | 0*SD_WAKE_IDLE_FAR \ | ||
106 | | 0*SD_PREFER_SIBLING \ | 104 | | 0*SD_PREFER_SIBLING \ |
107 | , \ | 105 | , \ |
108 | .last_balance = jiffies, \ | 106 | .last_balance = jiffies, \ |
@@ -129,13 +127,11 @@ int arch_update_cpu_topology(void); | |||
129 | | 1*SD_BALANCE_NEWIDLE \ | 127 | | 1*SD_BALANCE_NEWIDLE \ |
130 | | 1*SD_BALANCE_EXEC \ | 128 | | 1*SD_BALANCE_EXEC \ |
131 | | 1*SD_BALANCE_FORK \ | 129 | | 1*SD_BALANCE_FORK \ |
132 | | 1*SD_WAKE_IDLE \ | 130 | | 1*SD_BALANCE_WAKE \ |
133 | | 1*SD_WAKE_AFFINE \ | 131 | | 1*SD_WAKE_AFFINE \ |
134 | | 1*SD_WAKE_BALANCE \ | ||
135 | | 0*SD_SHARE_CPUPOWER \ | 132 | | 0*SD_SHARE_CPUPOWER \ |
136 | | 1*SD_SHARE_PKG_RESOURCES \ | 133 | | 1*SD_SHARE_PKG_RESOURCES \ |
137 | | 0*SD_SERIALIZE \ | 134 | | 0*SD_SERIALIZE \ |
138 | | 0*SD_WAKE_IDLE_FAR \ | ||
139 | | sd_balance_for_mc_power() \ | 135 | | sd_balance_for_mc_power() \ |
140 | | sd_power_saving_flags() \ | 136 | | sd_power_saving_flags() \ |
141 | , \ | 137 | , \ |
@@ -163,13 +159,11 @@ int arch_update_cpu_topology(void); | |||
163 | | 1*SD_BALANCE_NEWIDLE \ | 159 | | 1*SD_BALANCE_NEWIDLE \ |
164 | | 1*SD_BALANCE_EXEC \ | 160 | | 1*SD_BALANCE_EXEC \ |
165 | | 1*SD_BALANCE_FORK \ | 161 | | 1*SD_BALANCE_FORK \ |
166 | | 1*SD_WAKE_IDLE \ | 162 | | 1*SD_BALANCE_WAKE \ |
167 | | 0*SD_WAKE_AFFINE \ | 163 | | 0*SD_WAKE_AFFINE \ |
168 | | 1*SD_WAKE_BALANCE \ | ||
169 | | 0*SD_SHARE_CPUPOWER \ | 164 | | 0*SD_SHARE_CPUPOWER \ |
170 | | 0*SD_SHARE_PKG_RESOURCES \ | 165 | | 0*SD_SHARE_PKG_RESOURCES \ |
171 | | 0*SD_SERIALIZE \ | 166 | | 0*SD_SERIALIZE \ |
172 | | 0*SD_WAKE_IDLE_FAR \ | ||
173 | | sd_balance_for_package_power() \ | 167 | | sd_balance_for_package_power() \ |
174 | | sd_power_saving_flags() \ | 168 | | sd_power_saving_flags() \ |
175 | , \ | 169 | , \ |
@@ -191,14 +185,12 @@ int arch_update_cpu_topology(void); | |||
191 | | 1*SD_BALANCE_NEWIDLE \ | 185 | | 1*SD_BALANCE_NEWIDLE \ |
192 | | 0*SD_BALANCE_EXEC \ | 186 | | 0*SD_BALANCE_EXEC \ |
193 | | 0*SD_BALANCE_FORK \ | 187 | | 0*SD_BALANCE_FORK \ |
194 | | 0*SD_WAKE_IDLE \ | 188 | | 0*SD_BALANCE_WAKE \ |
195 | | 1*SD_WAKE_AFFINE \ | 189 | | 1*SD_WAKE_AFFINE \ |
196 | | 0*SD_WAKE_BALANCE \ | ||
197 | | 0*SD_SHARE_CPUPOWER \ | 190 | | 0*SD_SHARE_CPUPOWER \ |
198 | | 0*SD_POWERSAVINGS_BALANCE \ | 191 | | 0*SD_POWERSAVINGS_BALANCE \ |
199 | | 0*SD_SHARE_PKG_RESOURCES \ | 192 | | 0*SD_SHARE_PKG_RESOURCES \ |
200 | | 1*SD_SERIALIZE \ | 193 | | 1*SD_SERIALIZE \ |
201 | | 1*SD_WAKE_IDLE_FAR \ | ||
202 | | 0*SD_PREFER_SIBLING \ | 194 | | 0*SD_PREFER_SIBLING \ |
203 | , \ | 195 | , \ |
204 | .last_balance = jiffies, \ | 196 | .last_balance = jiffies, \ |