Commit e6c8fba7771563b2f3dfb96a78f36ec17e15bdf0

Authored by Peter Zijlstra
Committed by Ingo Molnar
1 parent 9ee349ad6d

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>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

... ... @@ -2046,6 +2046,9 @@
2046 2046 {
2047 2047 s64 delta;
2048 2048  
  2049 + if (p->sched_class != &fair_sched_class)
  2050 + return 0;
  2051 +
2049 2052 /*
2050 2053 * Buddy candidates are cache hot:
2051 2054 */
... ... @@ -2053,9 +2056,6 @@
2053 2056 (&p->se == cfs_rq_of(&p->se)->next ||
2054 2057 &p->se == cfs_rq_of(&p->se)->last))
2055 2058 return 1;
2056   -
2057   - if (p->sched_class != &fair_sched_class)
2058   - return 0;
2059 2059  
2060 2060 if (sysctl_sched_migration_cost == -1)
2061 2061 return 1;