Commit 1091985b authored by Ingo Molnar's avatar Ingo Molnar

sched: speed up update_load_add/_sub()

speed up update_load_add/_sub() by not delaying the division - this
reduces CPU pipeline dependencies.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 19ccd97a
...@@ -697,16 +697,17 @@ calc_delta_fair(unsigned long delta_exec, struct load_weight *lw) ...@@ -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); 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->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->weight -= dec;
lw->inv_weight = 0; if (likely(lw->weight))
lw->inv_weight = WMULT_CONST / lw->weight;
} }
/* /*
......
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