diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-12-16 12:04:33 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-16 13:01:54 -0500 |
commit | e6c8fba7771563b2f3dfb96a78f36ec17e15bdf0 (patch) | |
tree | 232d6ea7b028d3a98ea5eaa9ceffb21aff19db35 | |
parent | 9ee349ad6d326df3633d43f54202427295999c47 (diff) |
sched: Fix task_hot() test order
Make sure not to access sched_fair fields before verifying it is
indeed a sched_fair task.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
CC: stable@kernel.org
LKML-Reference: <20091216170517.577998058@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/sched.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 9c30858b6463..1d8ca25dd6fb 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2046,6 +2046,9 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) | |||
2046 | { | 2046 | { |
2047 | s64 delta; | 2047 | s64 delta; |
2048 | 2048 | ||
2049 | if (p->sched_class != &fair_sched_class) | ||
2050 | return 0; | ||
2051 | |||
2049 | /* | 2052 | /* |
2050 | * Buddy candidates are cache hot: | 2053 | * Buddy candidates are cache hot: |
2051 | */ | 2054 | */ |
@@ -2054,9 +2057,6 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) | |||
2054 | &p->se == cfs_rq_of(&p->se)->last)) | 2057 | &p->se == cfs_rq_of(&p->se)->last)) |
2055 | return 1; | 2058 | return 1; |
2056 | 2059 | ||
2057 | if (p->sched_class != &fair_sched_class) | ||
2058 | return 0; | ||
2059 | |||
2060 | if (sysctl_sched_migration_cost == -1) | 2060 | if (sysctl_sched_migration_cost == -1) |
2061 | return 1; | 2061 | return 1; |
2062 | if (sysctl_sched_migration_cost == 0) | 2062 | if (sysctl_sched_migration_cost == 0) |