From patchwork Thu Mar 21 16:05:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orit Wasserman X-Patchwork-Id: 229759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D95612C00B6 for ; Fri, 22 Mar 2013 03:32:16 +1100 (EST) Received: from localhost ([::1]:39098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIi24-0004t6-HC for incoming@patchwork.ozlabs.org; Thu, 21 Mar 2013 12:08:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIhzJ-0001Sy-VB for qemu-devel@nongnu.org; Thu, 21 Mar 2013 12:05:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIhzH-0005j4-Nt for qemu-devel@nongnu.org; Thu, 21 Mar 2013 12:05:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIhzH-0005gl-1a for qemu-devel@nongnu.org; Thu, 21 Mar 2013 12:05:07 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2LG55a2016001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 21 Mar 2013 12:05:05 -0400 Received: from dhcp-1-120.tlv.redhat.com (vpn-200-38.tlv.redhat.com [10.35.200.38]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2LG4SsW000931; Thu, 21 Mar 2013 12:04:59 -0400 From: Orit Wasserman To: qemu-devel@nongnu.org Date: Thu, 21 Mar 2013 18:05:37 +0200 Message-Id: <1363881940-27505-7-git-send-email-owasserm@redhat.com> In-Reply-To: <1363881940-27505-1-git-send-email-owasserm@redhat.com> References: <1363881940-27505-1-git-send-email-owasserm@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Orit Wasserman , pbonzini@redhat.com, mst@redhat.com, chegu_vinod@hp.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH v3 6/9] More optimized qemu_put_be64/32/16 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org qemu_put_be functions used qemu_put_byte this caused lots of 1 bytes buffers in the iovec. we move to use cpu_put_be64/32/16wu and put a single buffer per call. Signed-off-by: Orit Wasserman Reviewed-by: Juan Quintela --- savevm.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/savevm.c b/savevm.c index f69dce3..83aa9e7 100644 --- a/savevm.c +++ b/savevm.c @@ -795,22 +795,26 @@ void qemu_file_reset_rate_limit(QEMUFile *f) void qemu_put_be16(QEMUFile *f, unsigned int v) { - qemu_put_byte(f, v >> 8); - qemu_put_byte(f, v); + uint16_t p; + cpu_to_be16wu(&p, v); + + qemu_put_buffer(f, (uint8_t *)&p, sizeof(p)); } void qemu_put_be32(QEMUFile *f, unsigned int v) { - qemu_put_byte(f, v >> 24); - qemu_put_byte(f, v >> 16); - qemu_put_byte(f, v >> 8); - qemu_put_byte(f, v); + uint32_t p; + cpu_to_be32wu(&p, v); + + qemu_put_buffer(f, (uint8_t *)&p, sizeof(p)); } void qemu_put_be64(QEMUFile *f, uint64_t v) { - qemu_put_be32(f, v >> 32); - qemu_put_be32(f, v); + uint64_t p; + cpu_to_be64wu(&p, v); + + qemu_put_buffer(f, (uint8_t *)&p, sizeof(p)); } unsigned int qemu_get_be16(QEMUFile *f)