From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Daniel P. Berrange" Subject: Re: [libvirt] cgroup limits only affect kvm guest under certain conditions Date: Thu, 6 Jan 2011 13:36:34 +0000 Message-ID: <20110106133634.GJ29236@redhat.com> References: <4D25C079.3020107@in-telegence.net> Reply-To: "Daniel P. Berrange" Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: kvm@vger.kernel.org, libvir-list@redhat.com To: Dominik Klein Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32597 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751522Ab1AFNgv (ORCPT ); Thu, 6 Jan 2011 08:36:51 -0500 Content-Disposition: inline In-Reply-To: <4D25C079.3020107@in-telegence.net> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jan 06, 2011 at 02:15:37PM +0100, Dominik Klein wrote: > Hi > > I am playing with cgroups and try to limit block io for guests. > > The proof of concept is: > > # mkdir /dev/cgroup/blkio > # mount -t cgroup -o blkio blkio /dev/cgroup/blkio/ > # cd blkio/ > # mkdir test > # cd test/ > # ls -l /dev/vdisks/kirk > lrwxrwxrwx 1 root root 7 2011-01-06 13:46 /dev/vdisks/kirk -> ../dm-5 > # ls -l /dev/dm-5 > brw-rw---- 1 root disk 253, 5 2011-01-06 13:36 /dev/dm-5 > # echo "253:5 1048576" > blkio.throttle.write_bps_device > # echo $$ > tasks > # dd if=/dev/zero of=/dev/dm-5 bs=1M count=20 > 20+0 records in > 20+0 records out > 20971520 bytes (21 MB) copied, 20.0223 s, 1.0 MB/s > > So limit applies to the dd child of my shell. > > Now I assign /dev/dm-5 (/dev/vdisks/kirk) to a vm and echo the qemu-kvm > pid into tasks. Limits are not applied, the guest can happily use max io > bandwidth. Did you just echo the main qemu-kvm PID, or did you also add the PIDs of every thread too ? From this description of the problem, I'd guess you've only confined the main process thread and thus the I/O & VCPU threads are not confined. Daniel