From mboxrd@z Thu Jan 1 00:00:00 1970 From: Srivatsa Vaddagiri Subject: Re: Fwd: KVM and cpu limiting Date: Tue, 6 Jul 2010 10:09:45 +0530 Message-ID: <20100706043945.GD15598@linux.vnet.ibm.com> References: <20100702075758.GH12818@linux.vnet.ibm.com> Reply-To: vatsa@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, bharata@in.ibm.com, Balbir Singh To: Boris Dolgov Return-path: Received: from e2.ny.us.ibm.com ([32.97.182.142]:43831 "EHLO e2.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751160Ab0GFEkD (ORCPT ); Tue, 6 Jul 2010 00:40:03 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e2.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o664QdgH008735 for ; Tue, 6 Jul 2010 00:26:39 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o664dmKT159010 for ; Tue, 6 Jul 2010 00:39:48 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o664dmiI012545 for ; Tue, 6 Jul 2010 01:39:48 -0300 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Jul 02, 2010 at 08:38:37PM +0400, Boris Dolgov wrote: > On Fri, Jul 2, 2010 at 11:57 AM, Srivatsa Vaddagiri wrote: > >> Is it possible to limit cpu usage be VM when using qemu+kvm? > > > > Have you checked cpu controller? > It is very interesting. Looks like it is something, that I need. > So, limiting qemu process will limit cpu usage for the container? > I think, i will be able to configure it to provide guaranted cpu to > containers in that way. Note that shares control how much cpu bandwidth a VM gets _relative_ to other active VMs and hence is not a absolute measure of how much CPU capacity is provided to a particular VM. If the number of VMs deployed on a server and their relative priority remains static in general, then shares can be used as both "guarantee" and "limit" mechanism. > But what happens with the VM when qemu process is paused by the > scheduler? Will this time be counted as idle time for VM's cpu, No - it should be accounted as "runqueue wait time". > or it will be added to the state, which was used when qemu process was > paused? The runqueue wait time should reflect as "steal" time for the VMs. top command should show the steal time for a VM (look for 'st'), although I am not 100% sure whether steal time is reported in case of KVM guests. > > Why do you want to modify /proc/cpuinfo of VMs? > Just for information about the limits for the VMs' owners. Sounds like a cool idea - although not sure whether cpuinfo is the right place. You can try sending a patch and find out what the community thinks of it! - vatsa