diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-09-10 07:42:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-15 10:01:04 -0400 |
commit | 5f3edc1b1ead6d9bd45a85c551f44eff8fe76b9f (patch) | |
tree | 46f987010ca017be945831b76d8ea846f1ba8fc9 /kernel/sched.c | |
parent | aaee1203ca52b9db799433c33c9bffc33cdf8909 (diff) |
sched: Hook sched_balance_self() into sched_class::select_task_rq()
Rather ugly patch to fully place the sched_balance_self() code
inside the fair class.
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 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 60400a22401f..32b7a81230c2 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2350,7 +2350,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) | |||
2350 | if (unlikely(task_running(rq, p))) | 2350 | if (unlikely(task_running(rq, p))) |
2351 | goto out_activate; | 2351 | goto out_activate; |
2352 | 2352 | ||
2353 | cpu = p->sched_class->select_task_rq(p, sync); | 2353 | cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, sync); |
2354 | if (cpu != orig_cpu) { | 2354 | if (cpu != orig_cpu) { |
2355 | set_task_cpu(p, cpu); | 2355 | set_task_cpu(p, cpu); |
2356 | task_rq_unlock(rq, &flags); | 2356 | task_rq_unlock(rq, &flags); |
@@ -2525,11 +2525,6 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
2525 | 2525 | ||
2526 | __sched_fork(p); | 2526 | __sched_fork(p); |
2527 | 2527 | ||
2528 | #ifdef CONFIG_SMP | ||
2529 | cpu = sched_balance_self(cpu, SD_BALANCE_FORK); | ||
2530 | #endif | ||
2531 | set_task_cpu(p, cpu); | ||
2532 | |||
2533 | /* | 2528 | /* |
2534 | * Make sure we do not leak PI boosting priority to the child. | 2529 | * Make sure we do not leak PI boosting priority to the child. |
2535 | */ | 2530 | */ |
@@ -2560,6 +2555,11 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
2560 | if (!rt_prio(p->prio)) | 2555 | if (!rt_prio(p->prio)) |
2561 | p->sched_class = &fair_sched_class; | 2556 | p->sched_class = &fair_sched_class; |
2562 | 2557 | ||
2558 | #ifdef CONFIG_SMP | ||
2559 | cpu = p->sched_class->select_task_rq(p, SD_BALANCE_FORK, 0); | ||
2560 | #endif | ||
2561 | set_task_cpu(p, cpu); | ||
2562 | |||
2563 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) | 2563 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) |
2564 | if (likely(sched_info_on())) | 2564 | if (likely(sched_info_on())) |
2565 | memset(&p->sched_info, 0, sizeof(p->sched_info)); | 2565 | memset(&p->sched_info, 0, sizeof(p->sched_info)); |
@@ -3114,7 +3114,7 @@ out: | |||
3114 | void sched_exec(void) | 3114 | void sched_exec(void) |
3115 | { | 3115 | { |
3116 | int new_cpu, this_cpu = get_cpu(); | 3116 | int new_cpu, this_cpu = get_cpu(); |
3117 | new_cpu = sched_balance_self(this_cpu, SD_BALANCE_EXEC); | 3117 | new_cpu = current->sched_class->select_task_rq(current, SD_BALANCE_EXEC, 0); |
3118 | put_cpu(); | 3118 | put_cpu(); |
3119 | if (new_cpu != this_cpu) | 3119 | if (new_cpu != this_cpu) |
3120 | sched_migrate_task(current, new_cpu); | 3120 | sched_migrate_task(current, new_cpu); |