KVM: VMX: dynamise PLE window
authorRadim Krčmář <rkrcmar@redhat.com>
Thu, 21 Aug 2014 16:08:08 +0000 (18:08 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 21 Aug 2014 16:45:23 +0000 (18:45 +0200)
commitb4a2d31da812ce03efaf5d30c6b9d39c1cbd18d8
treee4596441b650badb49e4f46d75465d223e2dd9c4
parenta7653ecdf34c68a1af4fc085511afcf7ff011903
KVM: VMX: dynamise PLE window

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: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c