diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-12-16 12:04:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-16 13:01:59 -0500 |
commit | 738d2be4301007f054541c5c4bf7fb6a361c9b3a (patch) | |
tree | 6d37c04fa3b35d5fe820ab2df1088ba596fefe38 /kernel | |
parent | 88ec22d3edb72b261f8628226cd543589a6d5e1b (diff) |
sched: Simplify set_task_cpu()
Rearrange code a bit now that its a simpler function.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <20091216170518.269101883@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index f92ce63edfff..8a2bfd37ab4f 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2034,11 +2034,8 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) | |||
2034 | return delta < (s64)sysctl_sched_migration_cost; | 2034 | return delta < (s64)sysctl_sched_migration_cost; |
2035 | } | 2035 | } |
2036 | 2036 | ||
2037 | |||
2038 | void set_task_cpu(struct task_struct *p, unsigned int new_cpu) | 2037 | void set_task_cpu(struct task_struct *p, unsigned int new_cpu) |
2039 | { | 2038 | { |
2040 | int old_cpu = task_cpu(p); | ||
2041 | |||
2042 | #ifdef CONFIG_SCHED_DEBUG | 2039 | #ifdef CONFIG_SCHED_DEBUG |
2043 | /* | 2040 | /* |
2044 | * We should never call set_task_cpu() on a blocked task, | 2041 | * We should never call set_task_cpu() on a blocked task, |
@@ -2049,11 +2046,11 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu) | |||
2049 | 2046 | ||
2050 | trace_sched_migrate_task(p, new_cpu); | 2047 | trace_sched_migrate_task(p, new_cpu); |
2051 | 2048 | ||
2052 | if (old_cpu != new_cpu) { | 2049 | if (task_cpu(p) == new_cpu) |
2053 | p->se.nr_migrations++; | 2050 | return; |
2054 | perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, | 2051 | |
2055 | 1, 1, NULL, 0); | 2052 | p->se.nr_migrations++; |
2056 | } | 2053 | perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0); |
2057 | 2054 | ||
2058 | __set_task_cpu(p, new_cpu); | 2055 | __set_task_cpu(p, new_cpu); |
2059 | } | 2056 | } |