diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-11-25 07:31:39 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-09 04:03:02 -0500 |
commit | 970b13bacba14a8cef6f642861947df1d175b0b3 (patch) | |
tree | 9baa1fe0074b25ccacd58b2da98a3d2fa1e46d16 | |
parent | 6b314d0e11924c803bf8cd944e87fd58cdb5088c (diff) |
sched: Consolidate select_task_rq() callers
Small cleanup.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
[ v2: build fix ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 68db5a2e6545..01fd131b47a4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2323,6 +2323,14 @@ void task_oncpu_function_call(struct task_struct *p, | |||
2323 | preempt_enable(); | 2323 | preempt_enable(); |
2324 | } | 2324 | } |
2325 | 2325 | ||
2326 | #ifdef CONFIG_SMP | ||
2327 | static inline | ||
2328 | int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags) | ||
2329 | { | ||
2330 | return p->sched_class->select_task_rq(p, sd_flags, wake_flags); | ||
2331 | } | ||
2332 | #endif | ||
2333 | |||
2326 | /*** | 2334 | /*** |
2327 | * try_to_wake_up - wake up a thread | 2335 | * try_to_wake_up - wake up a thread |
2328 | * @p: the to-be-woken-up thread | 2336 | * @p: the to-be-woken-up thread |
@@ -2376,7 +2384,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, | |||
2376 | p->state = TASK_WAKING; | 2384 | p->state = TASK_WAKING; |
2377 | task_rq_unlock(rq, &flags); | 2385 | task_rq_unlock(rq, &flags); |
2378 | 2386 | ||
2379 | cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, wake_flags); | 2387 | cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags); |
2380 | if (cpu != orig_cpu) { | 2388 | if (cpu != orig_cpu) { |
2381 | local_irq_save(flags); | 2389 | local_irq_save(flags); |
2382 | rq = cpu_rq(cpu); | 2390 | rq = cpu_rq(cpu); |
@@ -2593,7 +2601,7 @@ void sched_fork(struct task_struct *p, int clone_flags) | |||
2593 | p->sched_class = &fair_sched_class; | 2601 | p->sched_class = &fair_sched_class; |
2594 | 2602 | ||
2595 | #ifdef CONFIG_SMP | 2603 | #ifdef CONFIG_SMP |
2596 | cpu = p->sched_class->select_task_rq(p, SD_BALANCE_FORK, 0); | 2604 | cpu = select_task_rq(p, SD_BALANCE_FORK, 0); |
2597 | #endif | 2605 | #endif |
2598 | local_irq_save(flags); | 2606 | local_irq_save(flags); |
2599 | update_rq_clock(cpu_rq(cpu)); | 2607 | update_rq_clock(cpu_rq(cpu)); |
@@ -3156,7 +3164,7 @@ out: | |||
3156 | void sched_exec(void) | 3164 | void sched_exec(void) |
3157 | { | 3165 | { |
3158 | int new_cpu, this_cpu = get_cpu(); | 3166 | int new_cpu, this_cpu = get_cpu(); |
3159 | new_cpu = current->sched_class->select_task_rq(current, SD_BALANCE_EXEC, 0); | 3167 | new_cpu = select_task_rq(current, SD_BALANCE_EXEC, 0); |
3160 | put_cpu(); | 3168 | put_cpu(); |
3161 | if (new_cpu != this_cpu) | 3169 | if (new_cpu != this_cpu) |
3162 | sched_migrate_task(current, new_cpu); | 3170 | sched_migrate_task(current, new_cpu); |