Credit2 is one of the virtual CPU (vCPU) scheduler available in the Xen hypervisor.
Credit2 was designed as a general purpose scheduler, with particular focus on improving handling of mixed workloads, scalability and support for low latency applications inside VMs, with respect to Credit1.
Credit2 is not in use by default. In order to use it as the Xen scheduler the following parameter should be passed to the hypervisor at boot:
Other parameters are available for tuning the behavior of Credit2 (see
docs/misc/xen-command-line.markdown for a complete list and for their meaning).
Once the system is live, for creating a cpupool with Credit2 as its scheduler, either compile a cpupool configuration file, as described in
docs/man/xlcpupool.cfg.pod.5 (and as exemplified in
tools/examples/cpupool), or use just
xl cpupool-create name=\"pool1\" sched=\"credit2\" cpus=[1,2]
Two kind of interactions with the scheduler are possible:
xl sched-credit2 -s
xl sched-credit2 -s -p pool1
xl sched-credit2 -s -r 100
xl sched-credit2 -d vm1
xl sched-credit2 -d vm1 -w 1024
Implementation entirely lives in the hypervisor. Xen has a pluggable, hook based, architecture for schedulers. Thanks to this, Credit2 code is all contained in
Global scheduling parameters, such as context switching rate limiting, is only available from Xen 4.8 onward. In libxl, the
LIBXL\_HAVE\_SCHED\_CREDIT2\_PARAMS symbol is introduced to indicate their availability.
The Credit1 scheduler comes with vCPU hard-affinity, vCPU soft-affinity and caps (see
docs/man/xl.pod.1.in for more details). In Credit2, vCPU hard affinity is supported starting from Xen 4.8, while soft-affinity and caps, while being worked on, are not yet available in any released hypervisor.
Any change done in Credit2 wants to be tested by doing at least the following:
Ideally, all the above steps should also be performed in a configuration where Credit2 is used as the scheduler of a cpupool, and by also doing the following:
|2016-10-14||1||Xen 4.8||Document written|