diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:04 -0400 |
commit | 1091985b482fdd577a5c511059b9d7b4467bd15d (patch) | |
tree | 1ea76f48b0f4c68072eb5eaa5113af6aa7dbd357 /kernel | |
parent | 19ccd97a03a026c2341b35af3ed2078a83c4a22b (diff) |
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: 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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 3209e2cc2c2e..992a1fae72a7 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -697,16 +697,17 @@ calc_delta_fair(unsigned long delta_exec, struct load_weight *lw) | |||
697 | return calc_delta_mine(delta_exec, NICE_0_LOAD, lw); | 697 | return calc_delta_mine(delta_exec, NICE_0_LOAD, lw); |
698 | } | 698 | } |
699 | 699 | ||
700 | static void update_load_add(struct load_weight *lw, unsigned long inc) | 700 | static inline void update_load_add(struct load_weight *lw, unsigned long inc) |
701 | { | 701 | { |
702 | lw->weight += inc; | 702 | lw->weight += inc; |
703 | lw->inv_weight = 0; | 703 | lw->inv_weight = WMULT_CONST / lw->weight; |
704 | } | 704 | } |
705 | 705 | ||
706 | static void update_load_sub(struct load_weight *lw, unsigned long dec) | 706 | static inline void update_load_sub(struct load_weight *lw, unsigned long dec) |
707 | { | 707 | { |
708 | lw->weight -= dec; | 708 | lw->weight -= dec; |
709 | lw->inv_weight = 0; | 709 | if (likely(lw->weight)) |
710 | lw->inv_weight = WMULT_CONST / lw->weight; | ||
710 | } | 711 | } |
711 | 712 | ||
712 | /* | 713 | /* |