• Peter Zijlstra's avatar
    sched: fix task_h_load() · 4be9daaa
    Peter Zijlstra authored
    Currently task_h_load() computes the load of a task and uses that to either
    subtract it from the total, or add to it.
    
    However, removing or adding a task need not have any effect on the total load
    at all. Imagine adding a task to a group that is local to one cpu - in that
    case the total load of that cpu is unaffected.
    
    So properly compute addition/removal:
    
     s_i = S * rw_i / \Sum_j rw_j
     s'_i = S * (rw_i + wl) / (\Sum_j rw_j + wg)
    
    then s'_i - s_i gives the change in load.
    
    Where s_i is the shares for cpu i, S the group weight, rw_i the runqueue weight
    for that cpu, wl the weight we add (subtract) and wg the weight contribution to
    the runqueue.
    Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
    Cc: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    4be9daaa
sched_fair.c 39.2 KB