50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
From 9a941183c365f4c6698c46aa13594e9bb360e8e9 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
Date: Tue, 10 Jun 2025 13:37:08 +0100
|
|
Subject: [PATCH 30/31] net/socket: skip automatic zero-init of large array
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
RH-MergeRequest: 461: Solve -ftrivial-auto-var-init performance regression with QEMU_UNINITIALIZED
|
|
RH-Jira: RHEL-99887
|
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
RH-Commit: [29/30] e7f35ae85a0ca50367487b1e7ed92b395b247cda
|
|
|
|
The 'net_socket_send' method has a 68k byte array used for copying
|
|
data between guest and host. Skip the automatic zero-init of this
|
|
array to eliminate the performance overhead in the I/O hot path.
|
|
|
|
The 'buf1' array will be fully initialized when reading data off
|
|
the network socket.
|
|
|
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
|
|
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
|
|
Message-id: 20250610123709.835102-31-berrange@redhat.com
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
(cherry picked from commit 751b0e79f1e0e7f88fad2fe2f22595ad03d78859)
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
---
|
|
net/socket.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/net/socket.c b/net/socket.c
|
|
index 8e3702e1f3..784dda686f 100644
|
|
--- a/net/socket.c
|
|
+++ b/net/socket.c
|
|
@@ -157,7 +157,7 @@ static void net_socket_send(void *opaque)
|
|
NetSocketState *s = opaque;
|
|
int size;
|
|
int ret;
|
|
- uint8_t buf1[NET_BUFSIZE];
|
|
+ QEMU_UNINITIALIZED uint8_t buf1[NET_BUFSIZE];
|
|
const uint8_t *buf;
|
|
|
|
size = recv(s->fd, buf1, sizeof(buf1), 0);
|
|
--
|
|
2.39.3
|
|
|