From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoVwk-0002KV-Mv for qemu-devel@nongnu.org; Fri, 08 Apr 2016 08:55:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoVwj-0003EK-5F for qemu-devel@nongnu.org; Fri, 08 Apr 2016 08:55:34 -0400 MIME-Version: 1.0 In-Reply-To: <20160408144056.3793c712@bahia.huguette.org> References: <20160408101054.14b77747@bahia.huguette.org> <20160408144056.3793c712@bahia.huguette.org> Date: Fri, 8 Apr 2016 14:55:29 +0200 Message-ID: From: Pradeep Kiruvale Content-Type: multipart/alternative; boundary=089e0115fc22a46dd2052ff8b541 Subject: Re: [Qemu-devel] Virtio-9p and cgroup io-throttling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: qemu-devel@nongnu.org, "qemu-discuss@nongnu.org" --089e0115fc22a46dd2052ff8b541 Content-Type: text/plain; charset=UTF-8 Hi Greg, FInd my replies inline > > > Below is the way how I add to blkio > > > > echo "8:16 8388608" > > > /sys/fs/cgroup/blkio/test/blkio.throttle.write_bps_device > > > > Ok, this just puts a limit of 8MB/s when writing to /dev/sdb for all > tasks in the test cgroup... but what about the tasks themselves ? > > > The problem I guess is adding these task ids to the "tasks" file in > cgroup > > > > Exactly. :) > > > These threads are started randomly and even then I add the PIDs to the > > tasks file the cgroup still does not do IO control. > > > > How did you get the PIDs ? Are you sure these threads you have added to the > cgroup are the ones that write to /dev/sdb ? > *Yes, I get PIDs from /proc/Qemu_PID/task* > > > Is it possible to reduce these number of threads? I see different number > of > > threads doing IO at different runs. > > > > AFAIK, no. > > Why don't you simply start QEMU in the cgroup ? Unless I miss something, > all > children threads, including the 9p ones, will be in the cgroup and honor > the > throttle setttings. > *I started the qemu with cgroup as below* *cgexec -g blkio:/test qemu.......* *Is there any other way of starting the qemu in cgroup?* Regards, Pradeep > > > Regards, > > Pradeep > > > > Cheers. > > -- > Greg > > > > > On 8 April 2016 at 10:10, Greg Kurz wrote: > > > > > On Thu, 7 Apr 2016 11:48:27 +0200 > > > Pradeep Kiruvale wrote: > > > > > > > Hi All, > > > > > > > > I am using virtio-9p for sharing the file between host and guest. To > test > > > > the shared file I do read/write options in the guest.To have > controlled > > > io, > > > > I am using cgroup blkio. > > > > > > > > While using cgroup I am facing two issues,Please find the issues > below. > > > > > > > > 1. When I do IO throttling using the cgroup the read throttling works > > > fine > > > > but the write throttling does not wok. It still bypasses these > throttling > > > > control and does the default, am I missing something here? > > > > > > > > > > Hi, > > > > > > Can you provide details on your blkio setup ? > > > > > > > I use the following commands to create VM, share the files and to > > > > read/write from guest. > > > > > > > > *Create vm* > > > > qemu-system-x86_64 -balloon none .......-name vm0 -cpu host -m 128 > -smp 1 > > > > -enable-kvm -parallel .... -fsdev > > > > local,id=sdb1,path=/mnt/sdb1,security_model=none,writeout=immediate > > > -device > > > > virtio-9p-pci,fsdev=sdb1,mount_tag=sdb1 > > > > > > > > *Mount file* > > > > mount -t 9p -o trans=virtio,version=9p2000.L sdb1 /sdb1_ext4 > 2>>dd.log && > > > > sync > > > > > > > > touch /sdb1_ext4/dddrive > > > > > > > > *Write test* > > > > dd if=/dev/zero of=/sdb1_ext4/dddrive bs=4k count=800000 > oflag=direct >> > > > > dd.log 2>&1 && sync > > > > > > > > *Read test* > > > > dd if=/sdb1_ext4/dddrive of=/dev/null >> dd.log 2>&1 && sync > > > > > > > > 2. The other issue is when I run "dd" command inside guest it > creates > > > > multiple threads to write/read. I can see those on host using iotop > is > > > this > > > > expected behavior? > > > > > > > > > > Yes. QEMU uses a thread pool to handle 9p requests. > > > > > > > Regards, > > > > Pradeep > > > > > > Cheers. > > > > > > -- > > > Greg > > > > > > > > --089e0115fc22a46dd2052ff8b541 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Greg,

FInd my replies inline

>
> Below is the way how I add to blkio
>
> echo "8:16 8388608" >
> /sys/fs/cgroup/blkio/test/blkio.throttle.write_bps_device
>

Ok, this just puts a limit of 8MB/s when writing to /dev/sdb for all=
tasks in the test cgroup... but what about the tasks themselves ?

> The problem I guess is adding these task ids to the "tasks" = file in cgroup
>

Exactly. :)

> These threads are started randomly and even then I add the PIDs to the=
> tasks file the cgroup still does not do IO control.
>

How did you get the PIDs ? Are you sure these threads you have added= to the
cgroup are the ones that write to /dev/sdb ?

Yes, I get PIDs from /proc/Qemu_PID/task

<= div>=C2=A0

> Is it possible to reduce these number of threads? I see different numb= er of
> threads doing IO at different runs.
>

AFAIK, no.

Why don't you simply start QEMU in the cgroup ? Unless I miss something= , all
children threads, including the 9p ones, will be in the cgroup and honor th= e
throttle setttings.


I started the qemu with cgroup as below
cgexec -g bl= kio:/test qemu.......
Is there any other way of starti= ng the qemu in cgroup?

Regards,
= Pradeep
=C2=A0

> Regards,
> Pradeep
>

Cheers.

--
Greg

>
> On 8 April 2016 at 10:10, Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:
>
> > On Thu, 7 Apr 2016 11:48:27 +0200
> > Pradeep Kiruvale <pradeepkiruvale@gmail.com> wrote:
> >
> > > Hi All,
> > >
> > > I am using virtio-9p for sharing the file between host and g= uest. To test
> > > the shared file I do read/write options in the guest.To have= controlled
> > io,
> > > I am using cgroup blkio.
> > >
> > > While using cgroup I am facing two issues,Please find the is= sues below.
> > >
> > > 1. When I do IO throttling using the cgroup the read throttl= ing works
> > fine
> > > but the write throttling does not wok. It still bypasses the= se throttling
> > > control and does the default, am I missing something here? > > >
> >
> > Hi,
> >
> > Can you provide details on your blkio setup ?
> >
> > > I use the following commands to create VM, share the files a= nd to
> > > read/write from guest.
> > >
> > > *Create vm*
> > > qemu-system-x86_64 -balloon none .......-name vm0 -cpu host = -m 128 -smp 1
> > > -enable-kvm -parallel .... -fsdev
> > > local,id=3Dsdb1,path=3D/mnt/sdb1,security_model=3Dnone,write= out=3Dimmediate
> > -device
> > > virtio-9p-pci,fsdev=3Dsdb1,mount_tag=3Dsdb1
> > >
> > > *Mount file*
> > > mount -t 9p -o trans=3Dvirtio,version=3D9p2000.L sdb1 /sdb1_= ext4 2>>dd.log &&
> > > sync
> > >
> > > touch /sdb1_ext4/dddrive
> > >
> > > *Write test*
> > > dd if=3D/dev/zero of=3D/sdb1_ext4/dddrive bs=3D4k count=3D80= 0000 oflag=3Ddirect >>
> > > dd.log 2>&1 && sync
> > >
> > > *Read test*
> > > dd if=3D/sdb1_ext4/dddrive of=3D/dev/null >> dd.log 2&= gt;&1 && sync
> > >
> > > 2. The other issue is when I run "dd" command insi= de guest=C2=A0 it creates
> > > multiple threads to write/read. I can see those on host usin= g iotop is
> > this
> > > expected behavior?
> > >
> >
> > Yes. QEMU uses a thread pool to handle 9p requests.
> >
> > > Regards,
> > > Pradeep
> >
> > Cheers.
> >
> > --
> > Greg
> >
> >


--089e0115fc22a46dd2052ff8b541--