From mboxrd@z Thu Jan 1 00:00:00 1970 From: Srivatsa Vaddagiri Subject: Re: Fwd: KVM and cpu limiting Date: Fri, 2 Jul 2010 13:27:58 +0530 Message-ID: <20100702075758.GH12818@linux.vnet.ibm.com> References: 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 e31.co.us.ibm.com ([32.97.110.149]:59991 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752548Ab0GBH6E (ORCPT ); Fri, 2 Jul 2010 03:58:04 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e31.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o627l9L2005971 for ; Fri, 2 Jul 2010 01:47:09 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o627w2wO115970 for ; Fri, 2 Jul 2010 01:58:02 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o627w1WO013535 for ; Fri, 2 Jul 2010 01:58:02 -0600 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: > Is it possible to limit cpu usage be VM when using qemu+kvm? Have you checked cpu controller? # mkdir /cpu_control # mount -t cgroup -o cpu none /cpu_control # cd /cpu_control # mkdir vm1 # mkdir vm2 Then change vm{1,2}/cpu.shares to control how much proportion of CPU capacity each VM gets. Basically, each vm is (soft-)limtied to: its allocated shares / total shares allocated for all VMs. > I need one server to run a lot of VMs (much more than cpu cores I > have). Each VM must have it's guaranted cpu time or time slice it must > use. This interface is more focused on limiting resource consumption rather than guaranteeing certain minimum. By carefully controlling how many VMs are run on the server and how many shares are allocated to each, this can be a good alternative to provide some "minimum" resources to a VM. Its slightly inflexible for guaranteeing "minimum" resource to a VM, but that's the best we have now. > Is it possible to make such limits? Is it possible to modify > /proc/cpuinfo of VMs? Why do you want to modify /proc/cpuinfo of VMs? - vatsa