• Peter Zijlstra's avatar
    sched: min_vruntime fix · 3fe69747
    Peter Zijlstra authored
    Current min_vruntime tracking is incorrect and will cause serious
    problems when we don't run the leftmost task for some reason.
    
    min_vruntime does two things; 1) it's used to determine a forward
    direction when the u64 vruntime wraps, 2) it's used to track the
    leftmost vruntime to position newly enqueued tasks from.
    
    The current logic advances min_vruntime whenever the current task's
    vruntime advance. Because the current task may pass the leftmost task
    still waiting we're failing the second goal. This causes new tasks to be
    placed too far ahead and thus penalizes their runtime.
    
    Fix this by making min_vruntime the min_vruntime of the waiting tasks by
    tracking it in enqueue/dequeue, and compare against current's vruntime
    to obtain the absolute minimum when placing new tasks.
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    3fe69747
sched_fair.c 33.6 KB