Skip to content

Commit

Permalink
sched: speed up update_load_add/_sub()
Browse files Browse the repository at this point in the history
speed up update_load_add/_sub() by not delaying the division - this
reduces CPU pipeline dependencies.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Mike Galbraith <efault@gmx.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Ingo Molnar committed Oct 15, 2007
1 parent 19ccd97 commit 1091985
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,16 +697,17 @@ calc_delta_fair(unsigned long delta_exec, struct load_weight *lw)
return calc_delta_mine(delta_exec, NICE_0_LOAD, lw);
}

static void update_load_add(struct load_weight *lw, unsigned long inc)
static inline void update_load_add(struct load_weight *lw, unsigned long inc)
{
lw->weight += inc;
lw->inv_weight = 0;
lw->inv_weight = WMULT_CONST / lw->weight;
}

static void update_load_sub(struct load_weight *lw, unsigned long dec)
static inline void update_load_sub(struct load_weight *lw, unsigned long dec)
{
lw->weight -= dec;
lw->inv_weight = 0;
if (likely(lw->weight))
lw->inv_weight = WMULT_CONST / lw->weight;
}

/*
Expand Down

0 comments on commit 1091985

Please sign in to comment.