• Peter Zijlstra's avatar
    sched: optimize effective_load() · cb5ef42a
    Peter Zijlstra authored
    s_i = S * rw_i / \Sum_j rw_j
    
     -> \Sum_j rw_j = S * rw_i / s_i
    
     -> s'_i = S * (rw_i + w) / (\Sum_j rw_j + w)
    
    delta s = s' - s = S * (rw + w) / ((S * rw / s) + w)
            = s * (S * (rw + w) / (S * rw + s * w) - 1)
    
     a = S*(rw+w), b = S*rw + s*w
    
    delta s = s * (a-b) / b
    
    IOW, trade one divide for two multiplies
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    cb5ef42a
sched_fair.c 39.2 KB