[fedora-virt] Where can I find information on pinning the host os to a cpu set in RHEL6?

Daniel P. Berrange berrange at redhat.com
Thu Dec 2 11:10:07 UTC 2010


On Wed, Dec 01, 2010 at 10:18:13PM +0000, Richard W.M. Jones wrote:
> On Wed, Dec 01, 2010 at 02:52:22PM -0700, Eric Blake wrote:
> > On 12/01/2010 02:41 PM, Richard W.M. Jones wrote:
> > > On Wed, Dec 01, 2010 at 02:11:34PM +0100, Henry Pepper wrote:
> > >> Hi
> > >>
> > >> I'm trying to find out how I can pin the host OS to a cpu set, e.g.
> > >> cpu0 on RHEL6.
> > >>
> > >> On Xen I simply pin the Domain-0 to a cpu set.
> > >>
> > >> But I don't seem to be able to identify the host OS in RHEL6/KVM.
> > > 
> > > Unlike Xen, the host isn't a special sort of guest.  The host is the
> > > host, and so you just use standard Linux techniques.
> > > 
> > > The way I know to do this is to add "isolcpus=..." on the Linux boot
> > > command line, although I've not used this for quite a long time and I
> > > haven't tried it on RHEL 6.
> > > 
> > > isolcpus works in reverse: it's the CPUs that you want Linux *not* to
> > > run on, so you probably want something like isolcpus=1-3
> > 
> > libvirt also has an XML notation for cpu pinning; it is part of the
> > <vcpu> element, documented
> > http://libvirt.org/formatdomain.html#elementsResources (although
> > admittedly the libvirt documentation could use more examples).
> 
> Although that doesn't work for the host (except maybe for Xen where
> the host is a funny sort of guest).
> 
> AIUI the reason you have to reboot with isolcpus is that otherwise you
> would have to pin every userspace and kernel task, including tasks
> that are created after you do the pinning.

You can pretty easily take care of that with cgroups. If you use
the 'cgconfig' init script it should create a child cgroup which
all system tasks are in by default. You then just need to move
libvirtd into a different cgroup, and everything libvirt spawns
(ie all its guests) will inherit that cgroup. So now you can
give differt cpu masks to each top level group (the system
default onje, and the libvirtd one).

That all said, IMHO, separating the host OS processes from the
VM processes via CPU masks is a pretty inefficient & wasteful
use of your hardware resources

Regards,
Daniel


More information about the virt mailing list