diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-29 17:46:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-29 17:46:05 -0400 |
commit | 7fda0412c5f7afdd1a5ff518f98dee5157266d8a (patch) | |
tree | d312af46758fa9b59431a479d258b54184a00591 /kernel/sched/core.c | |
parent | 6b8212a313dae341ef3a2e413dfec5c4dea59617 (diff) | |
parent | 160594e99dbbb0a5600ad922c630952c7c1c14bf (diff) |
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Ingo Molnar.
* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
cpusets: Remove an unused variable
sched/rt: Improve pick_next_highest_task_rt()
sched: Fix select_fallback_rq() vs cpu_active/cpu_online
sched/x86/smp: Do not enable IRQs over calibrate_delay()
sched: Fix compiler warning about declared inline after use
MAINTAINERS: Update email address for SCHEDULER and PERF EVENTS
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 62 |
1 files changed, 46 insertions, 16 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 157fb9b2b18..e3ed0ecee7c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -1265,29 +1265,59 @@ EXPORT_SYMBOL_GPL(kick_process); | |||
1265 | */ | 1265 | */ |
1266 | static int select_fallback_rq(int cpu, struct task_struct *p) | 1266 | static int select_fallback_rq(int cpu, struct task_struct *p) |
1267 | { | 1267 | { |
1268 | int dest_cpu; | ||
1269 | const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu)); | 1268 | const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu)); |
1269 | enum { cpuset, possible, fail } state = cpuset; | ||
1270 | int dest_cpu; | ||
1270 | 1271 | ||
1271 | /* Look for allowed, online CPU in same node. */ | 1272 | /* Look for allowed, online CPU in same node. */ |
1272 | for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask) | 1273 | for_each_cpu_mask(dest_cpu, *nodemask) { |
1274 | if (!cpu_online(dest_cpu)) | ||
1275 | continue; | ||
1276 | if (!cpu_active(dest_cpu)) | ||
1277 | continue; | ||
1273 | if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p))) | 1278 | if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p))) |
1274 | return dest_cpu; | 1279 | return dest_cpu; |
1280 | } | ||
1275 | 1281 | ||
1276 | /* Any allowed, online CPU? */ | 1282 | for (;;) { |
1277 | dest_cpu = cpumask_any_and(tsk_cpus_allowed(p), cpu_active_mask); | 1283 | /* Any allowed, online CPU? */ |
1278 | if (dest_cpu < nr_cpu_ids) | 1284 | for_each_cpu_mask(dest_cpu, *tsk_cpus_allowed(p)) { |
1279 | return dest_cpu; | 1285 | if (!cpu_online(dest_cpu)) |
1286 | continue; | ||
1287 | if (!cpu_active(dest_cpu)) | ||
1288 | continue; | ||
1289 | goto out; | ||
1290 | } | ||
1280 | 1291 | ||
1281 | /* No more Mr. Nice Guy. */ | 1292 | switch (state) { |
1282 | dest_cpu = cpuset_cpus_allowed_fallback(p); | 1293 | case cpuset: |
1283 | /* | 1294 | /* No more Mr. Nice Guy. */ |
1284 | * Don't tell them about moving exiting tasks or | 1295 | cpuset_cpus_allowed_fallback(p); |
1285 | * kernel threads (both mm NULL), since they never | 1296 | state = possible; |
1286 | * leave kernel. | 1297 | break; |
1287 | */ | 1298 | |
1288 | if (p->mm && printk_ratelimit()) { | 1299 | case possible: |
1289 | printk_sched("process %d (%s) no longer affine to cpu%d\n", | 1300 | do_set_cpus_allowed(p, cpu_possible_mask); |
1290 | task_pid_nr(p), p->comm, cpu); | 1301 | state = fail; |
1302 | break; | ||
1303 | |||
1304 | case fail: | ||
1305 | BUG(); | ||
1306 | break; | ||
1307 | } | ||
1308 | } | ||
1309 | |||
1310 | out: | ||
1311 | if (state != cpuset) { | ||
1312 | /* | ||
1313 | * Don't tell them about moving exiting tasks or | ||
1314 | * kernel threads (both mm NULL), since they never | ||
1315 | * leave kernel. | ||
1316 | */ | ||
1317 | if (p->mm && printk_ratelimit()) { | ||
1318 | printk_sched("process %d (%s) no longer affine to cpu%d\n", | ||
1319 | task_pid_nr(p), p->comm, cpu); | ||
1320 | } | ||
1291 | } | 1321 | } |
1292 | 1322 | ||
1293 | return dest_cpu; | 1323 | return dest_cpu; |