于 2011年03月29日 16:18, Nikunj A. Dadhania 写道:
On Tue, 29 Mar 2011 15:31:19 +0800, Daniel
Veillard<veillard(a)redhat.com> wrote:
> On Tue, Mar 29, 2011 at 02:32:18PM +0800, Osier Yang wrote:
>> Example of cputune XML:
>> <cputune>
>> <shares>2048</shares>
>> <vcpupin vcpu='0' cpuset='0-4,^1'/>
>> <vcpupin vcpu='1' cpuset='1,3'/>
>> <vcpupin vcpu='2' cpuset='0,2'/>
>> </cputune>
>>
>> "shares" is to define the the proportional weighted cpu share
>> for the domain.
>
> Hum, what does "2048" there means ? I assume there is an unit but
> it's not defined. Can we get a precide definition of the semantic of
> the shares construct. If I were to use it I need to know what it means,
> and I can't just from that description. Drivers in QEmu and LXC just
> pass that down to linux, but it still doesn't provide a semantic for
> it and "whatever linux implements at the time" is not really a good
> answer.
>
The number is relative wrt other domains/cgroup, so if we have two VMs
each having 2048, both of them will get equal share, i.e. 50% each. In a
different scenario, if we have VM1's share as 1024 and VM2's share as
2048, that translates as VM1=33% and VM2=66% share of the CPU.
V2 posted with idea from Matthias, and borrow some text from virsh doc.
Regards
Nikunj