[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/31] chardev/char-fd: skip automatic zero-init of large array
From: |
Stefan Hajnoczi |
Subject: |
[PULL 04/31] chardev/char-fd: skip automatic zero-init of large array |
Date: |
Wed, 11 Jun 2025 14:25:06 -0400 |
From: Daniel P. Berrangé <berrange@redhat.com>
The 'fd_chr_read' method has a 4k byte array used for copying
data between the socket and device. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O
hot path.
The 'buf' 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>
Message-id: 20250610123709.835102-5-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
chardev/char-fd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chardev/char-fd.c b/chardev/char-fd.c
index 23bfe3c0b1..6f03adf872 100644
--- a/chardev/char-fd.c
+++ b/chardev/char-fd.c
@@ -50,7 +50,7 @@ static gboolean fd_chr_read(QIOChannel *chan, GIOCondition
cond, void *opaque)
Chardev *chr = CHARDEV(opaque);
FDChardev *s = FD_CHARDEV(opaque);
int len;
- uint8_t buf[CHR_READ_BUF_LEN];
+ QEMU_UNINITIALIZED uint8_t buf[CHR_READ_BUF_LEN];
ssize_t ret;
len = sizeof(buf);
--
2.49.0
- [PULL 00/31] Block patches, Stefan Hajnoczi, 2025/06/11
- [PULL 02/31] hw/virtio/virtio: avoid cost of -ftrivial-auto-var-init in hot path, Stefan Hajnoczi, 2025/06/11
- [PULL 01/31] include/qemu/compiler: add QEMU_UNINITIALIZED attribute macro, Stefan Hajnoczi, 2025/06/11
- [PULL 04/31] chardev/char-fd: skip automatic zero-init of large array,
Stefan Hajnoczi <=
- [PULL 03/31] block: skip automatic zero-init of large array in ioq_submit, Stefan Hajnoczi, 2025/06/11
- [PULL 05/31] chardev/char-pty: skip automatic zero-init of large array, Stefan Hajnoczi, 2025/06/11
- [PULL 06/31] chardev/char-socket: skip automatic zero-init of large array, Stefan Hajnoczi, 2025/06/11
- [PULL 07/31] hw/audio/ac97: skip automatic zero-init of large arrays, Stefan Hajnoczi, 2025/06/11
- [PULL 10/31] hw/audio/gus: skip automatic zero-init of large array, Stefan Hajnoczi, 2025/06/11
- [PULL 08/31] hw/audio/cs4231a: skip automatic zero-init of large arrays, Stefan Hajnoczi, 2025/06/11
- [PULL 11/31] hw/audio/gus: skip automatic zero-init of large array, Stefan Hajnoczi, 2025/06/11
- [PULL 09/31] hw/audio/es1370: skip automatic zero-init of large array, Stefan Hajnoczi, 2025/06/11
- [PULL 12/31] hw/audio/sb16: skip automatic zero-init of large array, Stefan Hajnoczi, 2025/06/11
- [PULL 13/31] hw/audio/via-ac97: skip automatic zero-init of large array, Stefan Hajnoczi, 2025/06/11