diff options
Diffstat (limited to 'kernel/sched.c')
| -rw-r--r-- | kernel/sched.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index c4889abc00b6..92721d1534b8 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -1712,7 +1712,7 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags) | |||
| 1712 | 1712 | ||
| 1713 | p->prio = effective_prio(p); | 1713 | p->prio = effective_prio(p); |
| 1714 | 1714 | ||
| 1715 | if (!p->sched_class->task_new || !current->se.on_rq || !rq->cfs.curr) { | 1715 | if (!p->sched_class->task_new || !current->se.on_rq) { |
| 1716 | activate_task(rq, p, 0); | 1716 | activate_task(rq, p, 0); |
| 1717 | } else { | 1717 | } else { |
| 1718 | /* | 1718 | /* |
| @@ -2336,7 +2336,7 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
| 2336 | unsigned long max_pull; | 2336 | unsigned long max_pull; |
| 2337 | unsigned long busiest_load_per_task, busiest_nr_running; | 2337 | unsigned long busiest_load_per_task, busiest_nr_running; |
| 2338 | unsigned long this_load_per_task, this_nr_running; | 2338 | unsigned long this_load_per_task, this_nr_running; |
| 2339 | int load_idx; | 2339 | int load_idx, group_imb = 0; |
| 2340 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) | 2340 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) |
| 2341 | int power_savings_balance = 1; | 2341 | int power_savings_balance = 1; |
| 2342 | unsigned long leader_nr_running = 0, min_load_per_task = 0; | 2342 | unsigned long leader_nr_running = 0, min_load_per_task = 0; |
| @@ -2355,9 +2355,10 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
| 2355 | load_idx = sd->idle_idx; | 2355 | load_idx = sd->idle_idx; |
| 2356 | 2356 | ||
| 2357 | do { | 2357 | do { |
| 2358 | unsigned long load, group_capacity; | 2358 | unsigned long load, group_capacity, max_cpu_load, min_cpu_load; |
| 2359 | int local_group; | 2359 | int local_group; |
| 2360 | int i; | 2360 | int i; |
| 2361 | int __group_imb = 0; | ||
| 2361 | unsigned int balance_cpu = -1, first_idle_cpu = 0; | 2362 | unsigned int balance_cpu = -1, first_idle_cpu = 0; |
| 2362 | unsigned long sum_nr_running, sum_weighted_load; | 2363 | unsigned long sum_nr_running, sum_weighted_load; |
| 2363 | 2364 | ||
| @@ -2368,6 +2369,8 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
| 2368 | 2369 | ||
| 2369 | /* Tally up the load of all CPUs in the group */ | 2370 | /* Tally up the load of all CPUs in the group */ |
| 2370 | sum_weighted_load = sum_nr_running = avg_load = 0; | 2371 | sum_weighted_load = sum_nr_running = avg_load = 0; |
| 2372 | max_cpu_load = 0; | ||
| 2373 | min_cpu_load = ~0UL; | ||
| 2371 | 2374 | ||
| 2372 | for_each_cpu_mask(i, group->cpumask) { | 2375 | for_each_cpu_mask(i, group->cpumask) { |
| 2373 | struct rq *rq; | 2376 | struct rq *rq; |
| @@ -2388,8 +2391,13 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
| 2388 | } | 2391 | } |
| 2389 | 2392 | ||
| 2390 | load = target_load(i, load_idx); | 2393 | load = target_load(i, load_idx); |
| 2391 | } else | 2394 | } else { |
| 2392 | load = source_load(i, load_idx); | 2395 | load = source_load(i, load_idx); |
| 2396 | if (load > max_cpu_load) | ||
| 2397 | max_cpu_load = load; | ||
| 2398 | if (min_cpu_load > load) | ||
| 2399 | min_cpu_load = load; | ||
| 2400 | } | ||
| 2393 | 2401 | ||
| 2394 | avg_load += load; | 2402 | avg_load += load; |
| 2395 | sum_nr_running += rq->nr_running; | 2403 | sum_nr_running += rq->nr_running; |
| @@ -2415,6 +2423,9 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
| 2415 | avg_load = sg_div_cpu_power(group, | 2423 | avg_load = sg_div_cpu_power(group, |
| 2416 | avg_load * SCHED_LOAD_SCALE); | 2424 | avg_load * SCHED_LOAD_SCALE); |
| 2417 | 2425 | ||
| 2426 | if ((max_cpu_load - min_cpu_load) > SCHED_LOAD_SCALE) | ||
| 2427 | __group_imb = 1; | ||
| 2428 | |||
| 2418 | group_capacity = group->__cpu_power / SCHED_LOAD_SCALE; | 2429 | group_capacity = group->__cpu_power / SCHED_LOAD_SCALE; |
| 2419 | 2430 | ||
| 2420 | if (local_group) { | 2431 | if (local_group) { |
| @@ -2423,11 +2434,12 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
| 2423 | this_nr_running = sum_nr_running; | 2434 | this_nr_running = sum_nr_running; |
| 2424 | this_load_per_task = sum_weighted_load; | 2435 | this_load_per_task = sum_weighted_load; |
| 2425 | } else if (avg_load > max_load && | 2436 | } else if (avg_load > max_load && |
| 2426 | sum_nr_running > group_capacity) { | 2437 | (sum_nr_running > group_capacity || __group_imb)) { |
| 2427 | max_load = avg_load; | 2438 | max_load = avg_load; |
| 2428 | busiest = group; | 2439 | busiest = group; |
| 2429 | busiest_nr_running = sum_nr_running; | 2440 | busiest_nr_running = sum_nr_running; |
| 2430 | busiest_load_per_task = sum_weighted_load; | 2441 | busiest_load_per_task = sum_weighted_load; |
| 2442 | group_imb = __group_imb; | ||
| 2431 | } | 2443 | } |
| 2432 | 2444 | ||
| 2433 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) | 2445 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) |
| @@ -2499,6 +2511,9 @@ group_next: | |||
| 2499 | goto out_balanced; | 2511 | goto out_balanced; |
| 2500 | 2512 | ||
| 2501 | busiest_load_per_task /= busiest_nr_running; | 2513 | busiest_load_per_task /= busiest_nr_running; |
| 2514 | if (group_imb) | ||
| 2515 | busiest_load_per_task = min(busiest_load_per_task, avg_load); | ||
| 2516 | |||
| 2502 | /* | 2517 | /* |
| 2503 | * We're trying to get all the cpus to the average_load, so we don't | 2518 | * We're trying to get all the cpus to the average_load, so we don't |
| 2504 | * want to push ourselves above the average load, nor do we wish to | 2519 | * want to push ourselves above the average load, nor do we wish to |
| @@ -5282,11 +5297,20 @@ static struct ctl_table *sd_alloc_ctl_entry(int n) | |||
| 5282 | 5297 | ||
| 5283 | static void sd_free_ctl_entry(struct ctl_table **tablep) | 5298 | static void sd_free_ctl_entry(struct ctl_table **tablep) |
| 5284 | { | 5299 | { |
| 5285 | struct ctl_table *entry = *tablep; | 5300 | struct ctl_table *entry; |
| 5286 | 5301 | ||
| 5287 | for (entry = *tablep; entry->procname; entry++) | 5302 | /* |
| 5303 | * In the intermediate directories, both the child directory and | ||
| 5304 | * procname are dynamically allocated and could fail but the mode | ||
| 5305 | * will always be set. In the lowest directory the names are | ||
| 5306 | * static strings and all have proc handlers. | ||
| 5307 | */ | ||
| 5308 | for (entry = *tablep; entry->mode; entry++) { | ||
| 5288 | if (entry->child) | 5309 | if (entry->child) |
| 5289 | sd_free_ctl_entry(&entry->child); | 5310 | sd_free_ctl_entry(&entry->child); |
| 5311 | if (entry->proc_handler == NULL) | ||
| 5312 | kfree(entry->procname); | ||
| 5313 | } | ||
| 5290 | 5314 | ||
| 5291 | kfree(*tablep); | 5315 | kfree(*tablep); |
| 5292 | *tablep = NULL; | 5316 | *tablep = NULL; |
