[libvirt] [PATCH 2/3] qemu_driver: clamp value for setting sched cpu_shares with --config.

Dongsheng Yang yangds.fnst at cn.fujitsu.com
Thu May 15 11:49:21 UTC 2014


On 05/15/2014 09:17 PM, Eric Blake wrote:
> 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.
>
>
...
>
>> +++ 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.

Yes, I hate these numbers too. But the range is defined in 
kernel/sched/sched.h

#define MIN_SHARES  (1UL <<  1)
#define MAX_SHARES  (1UL << 18)

and used in scheduler.

shares = clamp(shares, scale_load(MIN_SHARES), scale_load(MAX_SHARES));

So we can not access it out from kernel.

As I found there was some numbers for period and quota here, I added
the shares number here.
>




More information about the libvir-list mailing list