Commit e6c8fba7 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

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: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
parent 9ee349ad
...@@ -2046,6 +2046,9 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) ...@@ -2046,6 +2046,9 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
{ {
s64 delta; s64 delta;
if (p->sched_class != &fair_sched_class)
return 0;
/* /*
* Buddy candidates are cache hot: * Buddy candidates are cache hot:
*/ */
...@@ -2054,9 +2057,6 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) ...@@ -2054,9 +2057,6 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
&p->se == cfs_rq_of(&p->se)->last)) &p->se == cfs_rq_of(&p->se)->last))
return 1; return 1;
if (p->sched_class != &fair_sched_class)
return 0;
if (sysctl_sched_migration_cost == -1) if (sysctl_sched_migration_cost == -1)
return 1; return 1;
if (sysctl_sched_migration_cost == 0) if (sysctl_sched_migration_cost == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment