From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:32975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWpvn-0001Ka-2J for qemu-devel@nongnu.org; Wed, 15 Jun 2011 09:14:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWpvl-0003MT-Aj for qemu-devel@nongnu.org; Wed, 15 Jun 2011 09:14:50 -0400 Received: from mail-bw0-f45.google.com ([209.85.214.45]:38017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWpvk-0003MN-Q1 for qemu-devel@nongnu.org; Wed, 15 Jun 2011 09:14:49 -0400 Received: by bwz16 with SMTP id 16so493335bwz.4 for ; Wed, 15 Jun 2011 06:14:47 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1307544625-22907-1-git-send-email-konishchev@gmail.com> <20110613082608.GA25582@stefanha-thinkpad.localdomain> Date: Wed, 15 Jun 2011 17:14:47 +0400 Message-ID: From: Dmitry Konishchev Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org On Wed, Jun 15, 2011 at 4:02 PM, Stefan Hajnoczi wrote= : > We need to fully understand performance before applying optimizations > on top. =C2=A0Otherwise it is possible to paper over a problem while > leaving the root cause unsolved. =C2=A0Avoiding lseek(2) is very importan= t, > not just for qemu-img but also for running VMs. =C2=A0lseek(2) should onl= y > be invoked if the image is growable/removable. > > When I run a VM from a virtio-blk raw image I see no lseek(2) calls. > > On the host: > strace -p $pid_of_qemu -f > > Inside the guest: > dd if=3D/dev/vda of=3D/dev/null iflag=3Ddirect > > I see pread(2) from the posix-aio-compat.c worker threads but no > lseek(2). =C2=A0The total_sectors cached value is being used. > > Does strace(1) show lseek(2) on your host? No, I don't see lseek() in the strace output. But in the other hand I see that bdrv_get_geometry() uses bdrv_getlength() which is implemented using lseek() in block/raw-posix.c... May be I'am mistaken about lseek(), but I get 9% slower version if disable caching. --=20 =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9 =D0=9A=D0=BE=D0=BD=D0=B8=D1=89= =D0=B5=D0=B2 (Dmitry Konishchev) mailto:konishchev@gmail.com