Skip to content

Commit

Permalink
sched: clean up the wakeup preempt check, #2
Browse files Browse the repository at this point in the history
clean up the preemption check to not use unnecessary 64-bit
variables. This improves code size:

   text    data     bss     dec     hex filename
  44227    3326      36   47589    b9e5 sched.o.before
  44201    3326      36   47563    b9cb sched.o.after

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Nov 9, 2007
1 parent 77d9cc4 commit 502d26b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p)
struct task_struct *curr = rq->curr;
struct cfs_rq *cfs_rq = task_cfs_rq(curr);
struct sched_entity *se = &curr->se, *pse = &p->se;
s64 delta, gran;
unsigned long gran;

if (unlikely(rt_prio(p->prio))) {
update_rq_clock(rq);
Expand All @@ -860,12 +860,11 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p)
pse = parent_entity(pse);
}

delta = se->vruntime - pse->vruntime;
gran = sysctl_sched_wakeup_granularity;
if (unlikely(se->load.weight != NICE_0_LOAD))
gran = calc_delta_fair(gran, &se->load);

if (delta > gran)
if (pse->vruntime + gran < se->vruntime)
resched_task(curr);
}

Expand Down

0 comments on commit 502d26b

Please sign in to comment.