Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1091985b482fdd577a5c511059b9d7b4467bd15d
Commit:     1091985b482fdd577a5c511059b9d7b4467bd15d
Parent:     19ccd97a03a026c2341b35af3ed2078a83c4a22b
Author:     Ingo Molnar <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 17:00:04 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 17:00:04 2007 +0200

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]>
    Signed-off-by: Mike Galbraith <[EMAIL PROTECTED]>
    Reviewed-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 kernel/sched.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 3209e2c..992a1fa 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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;
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to