Skip to content

Commit

Permalink
[PATCH] sched: optimize activate_task for RT task
Browse files Browse the repository at this point in the history
RT task does not participate in interactiveness priority and thus shouldn't
be bothered with timestamp and p->sleep_type manipulation when task is
being put on run queue.  Bypass all of the them with a single if (rt_task)
test.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Chen, Kenneth W authored and Linus Torvalds committed Dec 10, 2006
1 parent 0606671 commit 62ab616
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,9 @@ static void activate_task(struct task_struct *p, struct rq *rq, int local)
{
unsigned long long now;

if (rt_task(p))
goto out;

now = sched_clock();
#ifdef CONFIG_SMP
if (!local) {
Expand All @@ -961,8 +964,7 @@ static void activate_task(struct task_struct *p, struct rq *rq, int local)
(now - p->timestamp) >> 20);
}

if (!rt_task(p))
p->prio = recalc_task_prio(p, now);
p->prio = recalc_task_prio(p, now);

/*
* This checks to make sure it's not an uninterruptible task
Expand All @@ -987,7 +989,7 @@ static void activate_task(struct task_struct *p, struct rq *rq, int local)
}
}
p->timestamp = now;

out:
__activate_task(p, rq);
}

Expand Down

0 comments on commit 62ab616

Please sign in to comment.