On 05/15/2014 03:39 AM, Dongsheng Yang wrote:
As shown in 'man virsh' about schedinfo:
Note: The cpu_shares parameter has a valid value range of 0-262144;
This note documents historical kernel limits; if the kernel has changed,
this may be out of date.
Because when we set the value of cpu_shares, when flag is --live,
write the value into cgroup/cpu.shares. Then it will convert the
value into the range of [2, 262144]. When flag is --config, we
set the value into vmdef immidiately and 0 means no settting for
s/immidiately/immediately/
s/settting/setting/
cpu_shares. When we start vm again, libvirt use default value(1024)
s/use/uses/
for it.
This patch clamp the cpu_shares value when flag is --config, then
s/clamp/clamps/
we will get then "correct" settting in output of virsh
schedinfo
s/settting/setting/
and value in cgroup after next booting of vm.
+++ b/src/qemu/qemu_driver.c
@@ -112,6 +112,8 @@ VIR_LOG_INIT("qemu.qemu_driver");
#define QEMU_SCHED_MAX_PERIOD 1000000LL
#define QEMU_SCHED_MIN_QUOTA 1000LL
#define QEMU_SCHED_MAX_QUOTA 18446744073709551LL
+#define QEMU_SCHED_MIN_SHARES 2LL
+#define QEMU_SCHED_MAX_SHARES 262144LL
I'm a bit reluctant to add these numbers - if the kernel ever changes
its range again (which HAS happened for some cgroup tunables), then we
are needlessly preventing use of the newer range.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org