From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDBxS-0002yk-W8 for qemu-devel@nongnu.org; Mon, 10 Oct 2011 05:15:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDBxR-00038y-UL for qemu-devel@nongnu.org; Mon, 10 Oct 2011 05:15:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDBxR-00038s-KK for qemu-devel@nongnu.org; Mon, 10 Oct 2011 05:15:37 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9A9FaA1004688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Oct 2011 05:15:36 -0400 Date: Mon, 10 Oct 2011 11:16:40 -0200 From: "Michael S. Tsirkin" Message-ID: <20111010131639.GB23679@redhat.com> References: <20111009235629.GB9542@redhat.com> <4E92A1FB.70706@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E92A1FB.70706@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC] qemu-file: output data directly if possible List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Mon, Oct 10, 2011 at 09:42:51AM +0200, Paolo Bonzini wrote: > On 10/10/2011 01:56 AM, Michael S. Tsirkin wrote: > >qemu file currently always buffers up data before writing it out. > >At least for memory this is probably not a good idea: > >writing out to file would be cheaper. Let's do > >that if we can, which should be the common case. If we can't, buffer. > > > >Signed-off-by: Michael S. Tsirkin > > > >--- > > > >Completely untested, this is just thinking aloud. > >Shouldn't the below save us a data copy in the > >common case, helping speed up migration? > > The problem here is qemu_put_byte and friends, where the indirection > of a function call would probably slow things down. In the common > case, qemu_put_byte is called a lot and f->buf_index would not be > zero. True, maybe the right thing to do is use a size cutoff, avoid a copy if buffer is large enough. I note the buffer in qemu file is 32K - is that based on some specific measurements or just a random large number? Any objections to making it smaller, like 4K? > The way to go would probably be to merge QEMUFile and > QEMUBufferedFile's two buffering layers, which also removes a copy. > > Paolo Yes, it does look sane. QEMUFile doesn't seem to ever be used without QEMUBufferedFile - is that true? -- MST