Professional Documents
Culture Documents
net/publication/261247420
Virtual Cpu Scheduling Techniques for Kernel Based Virtual Machine (Kvm)
CITATIONS READS
10 2,144
1 author:
K.T. Raghavendra
4 PUBLICATIONS 27 CITATIONS
SEE PROFILE
All content following this page was uploaded by K.T. Raghavendra on 15 August 2018.
Abstract—In a multi-CPU Virtual Machine(VM), virtual CPUs 2) Optimizing the VCPU scheduling in under-commit sce-
(VCPUs) are not guaranteed to be scheduled simultaneously. nario by detecting potential under-commit cases.
Operating System (OS) constructs, such as busy-wait (for e.g., 3) Refining the VCPU candidate to yield to by determining
spin locks) are written with an assumption of CPUs running con-
currently on bare-metal wastes lot of CPU time. The Hardware potential Lock Holder Preempted (LHP) VCPUs.
assisted Pause Loop Exit (PLE) feature detects unnecessary busy-
loop constructs in guest VMs and traps to the VCPU scheduler
II. V IRTUAL CPU (VCPU) SCHEDULING TECHNIQUES
a.k.a PLE handler to choose a best VCPU candidate to run. A simplified original PLE handler algorithm is presented
The existing approach (before the optimization mentioned in the in Fig. 1. It iterates over all the VCPUs until it finds a non
paper) does a directed yield1 to a random VCPU and needs more
running VCPU and does a directed yield. Searching for the non
intelligence.
We also need to carefully consider the over-commit ratio2 while running VCPU starts from the last boosted VCPU3 . This logic
designing the VCPU scheduling algorithm. For e.g., trapping to has high probability of yielding to a spinning VCPU. Yielding
the PLE handler is an overhead during under-commit cases. The to such VCPUs result in severe performance degradation.
existing approach lacks the over-commit ratio awareness. Hence
we need effective scheduling of VCPUs to boost the performance function PLE HANDLER(vcpu V)
of VMs. kvm = V.kvm
We present three major improvements to old VCPU scheduling
technique that include choosing a better VCPU for directed yield last boosted vcpu = kvm.last boosted vcpu
and optimizing for under-commit cases. All these approaches yielded = 0
have been accepted into Linux kernel. These changes potentially for pass = 0; pass < 2 AND !yielded AND try; do
bring around 300-400% improvements to I/O intensive cloud for i = 0; i < num vcpu; i = i + 1 do
VMs (large under-committed guests) and up to 25% improvement we assume i spans 1 to total VCPU in VM
to over-committed CPU intensive VMs.
if !pass AND i <= last boosted vcpu then
I. I NTRODUCTION i <= last boosted vcpu
continue
Adapting traditional Operating Systems (OSs) to virtual-
else if pass AND i > last boosted vcpu then
ization has been a complex process. In virtualization, virtual
break
CPUs (VCPUs) are tasks for host OS. Busy-wait constructs
end if
with an assumption of CPUs running in parallel leads to
cur vcpu = kvm.vcpu array[i];
performance degradation [1]. The hardware assisted Pause
if cur vcpu = V then
Loop Exit (PLE) [2] feature detects busy-wait and forces
continue
guest exit and traps to the PLE handler. The PLE handler of
end if
KVM [3] takes VCPU scheduling decisions. But unfortunately
if cur vcpu.running = V then
the PLE feature lacks the knowledge of under-commit cases
continue
where each VCPU can be mapped to at least one physical
end if
CPU, which obviates the need for any special mechanism
if kvm vcpu yield to(cur vcpu) then
to address busy-wait related problems. Instead it adds more
kvm.last boosted vcpu = i
overhead. Hence we need under-commit aware intelligent
end if
VCPU scheduling techniques which is also smart to choose
end for
better VCPU in over-commit cases. In this paper we discuss
pass = pass + 1
about three algorithmic improvements to current KVM PLE
end for
handler in the Linux kernel [4] viz.,
end function
1) Choosing a better VCPU to do directed yield by recog-
nizing the VCPUs that are busy-looping. Fig. 1. Original PLE handler