• Peter Zijlstra's avatar
    sched/eevdf: Fix avg_vruntime() · 650cad56
    Peter Zijlstra authored
    The expectation is that placing a task at avg_vruntime() makes it
    eligible. Turns out there is a corner case where this is not the case.
    
    Specifically, avg_vruntime() relies on the fact that integer division
    is a flooring function (eg. it discards the remainder). By this
    property the value returned is slightly left of the true average.
    
    However! when the average is a negative (relative to min_vruntime) the
    effect is flipped and it becomes a ceil, with the result that the
    returned value is just right of the average and thus not eligible.
    
    Fixes: af4cf404 ("sched/fair: Add cfs_rq::avg_vruntime")
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    650cad56
fair.c 345 KB