From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59382 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEPng-0000MU-WF for qemu-devel@nongnu.org; Tue, 18 May 2010 12:37:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OEPnc-0007xa-UJ for qemu-devel@nongnu.org; Tue, 18 May 2010 12:37:46 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:47606) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OEPnc-0007xO-PJ for qemu-devel@nongnu.org; Tue, 18 May 2010 12:37:44 -0400 Received: by fxm15 with SMTP id 15so164905fxm.4 for ; Tue, 18 May 2010 09:37:43 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1273873950-25756-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1273873950-25756-1-git-send-email-stefanha@linux.vnet.ibm.com> Date: Tue, 18 May 2010 18:37:42 +0200 Message-ID: Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Avoid zeroing every request structure From: Corentin Chary Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org On Fri, May 14, 2010 at 11:52 PM, Stefan Hajnoczi wrote: > The VirtIOBlockRequest structure is about 40 KB in size. =A0This patch > avoids zeroing every request by only initializing fields that are read. > The other fields are either written to or may not be used at all. > > Oprofile shows about 10% of CPU samples in memset called by > virtio_blk_alloc_request(). =A0The workload is > dd if=3D/dev/vda of=3D/dev/null iflag=3Ddirect bs=3D8k running concurrent= ly 4 > times. =A0This patch makes memset disappear to the bottom of the profile. > Did you try to profile using calloc in qemu_mallocz instead of malloc + mem= set ? $ man calloc calloc() allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. __The memory is set to zero.__ --=20 Corentin Chary http://xf.iksaif.net