Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kf9GM-000279-Vd for qemu-devel@nongnu.org; Mon, 15 Sep 2008 04:16:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kf9GL-00026w-Is for qemu-devel@nongnu.org; Mon, 15 Sep 2008 04:16:50 -0400 Received: from [199.232.76.173] (port=49402 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kf9GL-00026s-Eu for qemu-devel@nongnu.org; Mon, 15 Sep 2008 04:16:49 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:47873) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kf9GK-0002ZA-Tq for qemu-devel@nongnu.org; Mon, 15 Sep 2008 04:16:49 -0400 Message-Id: <48CEA68A0200006D00002538@victor.provo.novell.com> Date: Mon, 15 Sep 2008 02:16:40 -0600 From: "Wei Kong" Subject: Re: Re: [Qemu-devel] [PATCH] qemu_aio_poll optimize Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws, qemu-devel@nongnu.org Cc: Kevin Wolf , Jim Fehlig I will test the latest QEMU later. --Best Regards Kong Wei >>> Anthony Liguori 08/09/12 21:58 >>> > qemu_aio_poll() exhaust 50% cpu utilization rate in whole qemu running, > due to it scan RawAIOCB chain list loop and loop, especially when > these RawAIOCB are still in EINPROGRESS at IO flood. > =20 Have you tested this with the very latest QEMU SVN? The recent change=20 (yesterday) makes it so that qemu_aio_poll is not called in every CPU=20 iteration. Regards, Anthony Liguori > This tune will reduce 2.2% ~ 2.5% total cpu utilization rate, > qemu_aio_poll() will exhaust 5% cpu in whole qemu running > and a little increase the IO through. > > Signed-off-by: Wei Kong > --- > > --- a/block-raw-posix.c > +++ b/block-raw-posix.c > @@ -289,40 +289,36 @@ void qemu_aio_poll(void) > RawAIOCB *acb, **pacb; > int ret; > > + pacb =3D &first_aio; > for(;;) { > - pacb =3D &first_aio; > - for(;;) { > - acb =3D *pacb; > - if (!acb) > - goto the_end; > - ret =3D aio_error(&acb->aiocb); > - if (ret =3D=3D ECANCELED) { > - /* remove the request */ > - *pacb =3D acb->next; > - qemu_aio_release(acb); > - } else if (ret !=3D EINPROGRESS) { > - /* end of aio */ > - if (ret =3D=3D 0) { > - ret =3D aio_return(&acb->aiocb); > - if (ret =3D=3D acb->aiocb.aio_nbytes) > - ret =3D 0; > - else > - ret =3D -EINVAL; > - } else { > - ret =3D -ret; > - } > - /* remove the request */ > - *pacb =3D acb->next; > - /* call the callback */ > - acb->common.cb(acb->common.opaque, ret); > - qemu_aio_release(acb); > - break; > + acb =3D *pacb; > + if (!acb) > + break; > + ret =3D aio_error(&acb->aiocb); > + if (ret =3D=3D EINPROGRESS) { > + break; > + } else if (ret !=3D ECANCELED) { > + /* end of aio */ > + if (ret =3D=3D 0) { > + ret =3D aio_return(&acb->aiocb); > + if (ret =3D=3D acb->aiocb.aio_nbytes) > + ret =3D 0; > + else > + ret =3D -EINVAL; > } else { > - pacb =3D &acb->next; > + ret =3D -ret; > } > - } > + /* remove the request */ > + *pacb =3D acb->next; > + /* call the callback */ > + acb->common.cb(acb->common.opaque, ret); > + qemu_aio_release(acb); > + } else { > + /* remove the request */ > + *pacb =3D acb->next; > + qemu_aio_release(acb); > + } > } > - the_end: ; > } > > /* Wait for all IO requests to complete. */ > > > =20