[libvirt] [PATCH 1/2] Correct minimum cpu_shares value

Dave Allan dallan at redhat.com
Tue Jul 26 03:55:43 UTC 2011


On Tue, Jul 26, 2011 at 11:44:37AM +0800, Osier Yang wrote:
> 于 2011年07月26日 09:48, Dave Allan 写道:
> >Fixes bz 639591
> >---
> >  tools/virsh.pod |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> >diff --git a/tools/virsh.pod b/tools/virsh.pod
> >index 5b7fa9c..dd3457c 100644
> >--- a/tools/virsh.pod
> >+++ b/tools/virsh.pod
> >@@ -696,7 +696,7 @@ If I<--live>  is specified, set scheduler information of a running guest.
> >  If I<--config>  is specified, affect the next boot of a persistent guest.
> >  If I<--current>  is specified, affect the current guest state.
> >
> >-B<Note>: The cpu_shares parameter has a valid value range of 0-262144; Negative
> >+B<Note>: The cpu_shares parameter has a valid value range of 2-262144; Negative
> >  values are wrapped to positive, and larger values are capped at the maximum.
> >  Therefore, -1 is a useful shorthand for 262144.
> >
> 
> What Linda commented in the bug is wrong.
> 
> # echo 2048 > /sys/fs/cgroup/cpu/cpu.shares
> -bash: echo: write error: Invalid argument
> 
> # echo 4 > /sys/fs/cgroup/cpu/cpu.shares
> -bash: echo: write error: Invalid argument
> 
> The error is not from cgroup. Actually it doesn't report
> any error and silently set cpu.shares to 2 if the value
> one passed is lower than 2.
> 
> But I guess kernel will not think it as a bug, what we can do
> is improving the doc. But I guess the improvement in this
> patch doesn't tell the whole truth.
> 
> # virsh schedinfo test --set cpu_shares=0
> Scheduler : posix
> cpu_shares : 2
> 
> Only saying the valid range is 0-2621244 doesn't explain why we
> still allows 0,
> but no error, and the cpu.shares is silently set to "2".
> 
> Regards
> Osier

Ok, then self-NAK until we get this sorted out.

Dave




More information about the libvir-list mailing list