• Radim Krčmář's avatar
    KVM: VMX: dynamise PLE window · b4a2d31d
    Radim Krčmář authored
    Window is increased on every PLE exit and decreased on every sched_in.
    The idea is that we don't want to PLE exit if there is no preemption
    going on.
    We do this with sched_in() because it does not hold rq lock.
    
    There are two new kernel parameters for changing the window:
     ple_window_grow and ple_window_shrink
    ple_window_grow affects the window on PLE exit and ple_window_shrink
    does it on sched_in;  depending on their value, the window is modifier
    like this: (ple_window is kvm_intel's global)
    
      ple_window_shrink/ |
      ple_window_grow    | PLE exit           | sched_in
      -------------------+--------------------+---------------------
      < 1                |  = ple_window      |  = ple_window
      < ple_window       | *= ple_window_grow | /= ple_window_shrink
      otherwise          | += ple_window_grow | -= ple_window_shrink
    
    A third new parameter, ple_window_max, controls the maximal ple_window;
    it is internally rounded down to a closest multiple of ple_window_grow.
    
    VCPU's PLE window is never allowed below ple_window.
    Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    b4a2d31d
vmx.c 259 KB