b7fbd568b2
- kvm-migration-Move-yank-outside-qemu_start_incoming_migr.patch [bz#1974683] - kvm-migration-Allow-reset-of-postcopy_recover_triggered-.patch [bz#1974683] - kvm-Remove-RHEL-7.0.0-machine-type.patch [bz#1968519] - kvm-Remove-RHEL-7.1.0-machine-type.patch [bz#1968519] - kvm-Remove-RHEL-7.2.0-machine-type.patch [bz#1968519] - kvm-Remove-RHEL-7.3.0-machine-types.patch [bz#1968519] - kvm-Remove-RHEL-7.4.0-machine-types.patch [bz#1968519] - kvm-Remove-RHEL-7.5.0-machine-types.patch [bz#1968519] - kvm-acpi-pc-revert-back-to-v5.2-PCI-slot-enumeration.patch [bz#1957194] - kvm-migration-failover-reset-partially_hotplugged.patch [bz#1957194] - kvm-hmp-Fix-loadvm-to-resume-the-VM-on-success-instead-o.patch [bz#1957194] - kvm-migration-Move-bitmap_mutex-out-of-migration_bitmap_.patch [bz#1957194] - kvm-i386-cpu-Expose-AVX_VNNI-instruction-to-guest.patch [bz#1957194] - kvm-ratelimit-protect-with-a-mutex.patch [bz#1957194] - kvm-Update-Linux-headers-to-5.13-rc4.patch [bz#1957194] - kvm-i386-Add-ratelimit-for-bus-locks-acquired-in-guest.patch [bz#1957194] - kvm-iothread-generalize-iothread_set_param-iothread_get_.patch [bz#1957194] - kvm-iothread-add-aio-max-batch-parameter.patch [bz#1957194] - kvm-linux-aio-limit-the-batch-size-using-aio-max-batch-p.patch [bz#1957194] - kvm-block-nvme-Fix-VFIO_MAP_DMA-failed-No-space-left-on-.patch [bz#1957194] - kvm-migration-move-wait-unplug-loop-to-its-own-function.patch [bz#1957194] - kvm-migration-failover-continue-to-wait-card-unplug-on-e.patch [bz#1957194] - kvm-aarch64-Add-USB-storage-devices.patch [bz#1957194] - kvm-iotests-Improve-and-rename-test-291-to-qemu-img-bitm.patch [bz#1957194] - kvm-qemu-img-Fail-fast-on-convert-bitmaps-with-inconsist.patch [bz#1957194] - kvm-qemu-img-Add-skip-broken-bitmaps-for-convert-bitmaps.patch [bz#1957194] - kvm-audio-Never-send-migration-section.patch [bz#1957194] - kvm-pc-bios-s390-ccw-bootmap-Silence-compiler-warning-fr.patch [bz#1939509 bz#1940132] - kvm-pc-bios-s390-ccw-Use-reset_psw-pointer-instead-of-ha.patch [bz#1939509 bz#1940132] - kvm-pc-bios-s390-ccw-netboot-Use-Wl-prefix-to-pass-param.patch [bz#1939509 bz#1940132] - kvm-pc-bios-s390-ccw-Silence-warning-from-Clang-by-marki.patch [bz#1939509 bz#1940132] - kvm-pc-bios-s390-ccw-Fix-the-cc-option-macro-in-the-Make.patch [bz#1939509 bz#1940132] - kvm-pc-bios-s390-ccw-Silence-GCC-11-stringop-overflow-wa.patch [bz#1939509 bz#1940132] - kvm-pc-bios-s390-ccw-Allow-building-with-Clang-too.patch [bz#1939509 bz#1940132] - kvm-pc-bios-s390-ccw-Fix-inline-assembly-for-older-versi.patch [bz#1939509 bz#1940132] - kvm-configure-Fix-endianess-test-with-LTO.patch [bz#1939509 bz#1940132] - kvm-spec-Switch-toolchain-to-Clang-LLVM.patch [bz#1939509 bz#1940132] - kvm-spec-Use-safe-stack-for-x86_64.patch [bz#1939509 bz#1940132] - kvm-spec-Reenable-write-support-for-VMDK-etc.-in-tools.patch [bz#1989841] - Resolves: bz#1974683 (Fail to set migrate incoming for 2nd time after the first time failed) - Resolves: bz#1968519 (Remove all the old 7.0-7.5 machine types) - Resolves: bz#1957194 (Synchronize RHEL-AV 8.5.0 changes to RHEL 9.0.0 Beta) - Resolves: bz#1939509 (QEMU: enable SafeStack) - Resolves: bz#1940132 (QEMU: switch build toolchain to Clang/LLVM) - Resolves: bz#1989841 (RFE: qemu-img cannot convert images into vmdk and vpc formats)
85 lines
3.2 KiB
Diff
85 lines
3.2 KiB
Diff
From 6f4cb3e1e5d718356f16645e806d47cb2159ae98 Mon Sep 17 00:00:00 2001
|
|
From: Stefano Garzarella <sgarzare@redhat.com>
|
|
Date: Thu, 29 Jul 2021 07:42:33 -0400
|
|
Subject: [PATCH 19/39] linux-aio: limit the batch size using `aio-max-batch`
|
|
parameter
|
|
|
|
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
|
RH-MergeRequest: 32: Synchronize with RHEL-AV 8.5 release 27 to RHEL 9
|
|
RH-Commit: [11/15] 44e2f2d294d8ed1d13fb29c5c1599543b86c67e5 (mrezanin/centos-src-qemu-kvm)
|
|
RH-Bugzilla: 1957194
|
|
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
RH-Acked-by: Andrew Jones <drjones@redhat.com>
|
|
|
|
When there are multiple queues attached to the same AIO context,
|
|
some requests may experience high latency, since in the worst case
|
|
the AIO engine queue is only flushed when it is full (MAX_EVENTS) or
|
|
there are no more queues plugged.
|
|
|
|
Commit 2558cb8dd4 ("linux-aio: increasing MAX_EVENTS to a larger
|
|
hardcoded value") changed MAX_EVENTS from 128 to 1024, to increase
|
|
the number of in-flight requests. But this change also increased
|
|
the potential maximum batch to 1024 elements.
|
|
|
|
When there is a single queue attached to the AIO context, the issue
|
|
is mitigated from laio_io_unplug() that will flush the queue every
|
|
time is invoked since there can't be others queue plugged.
|
|
|
|
Let's use the new `aio-max-batch` IOThread parameter to mitigate
|
|
this issue, limiting the number of requests in a batch.
|
|
|
|
We also define a default value (32): this value is obtained running
|
|
some benchmarks and it represents a good tradeoff between the latency
|
|
increase while a request is queued and the cost of the io_submit(2)
|
|
system call.
|
|
|
|
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
Message-id: 20210721094211.69853-4-sgarzare@redhat.com
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
(cherry picked from commit d7ddd0a1618a75b31dc308bb37365ce1da972154)
|
|
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
---
|
|
block/linux-aio.c | 9 ++++++++-
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/block/linux-aio.c b/block/linux-aio.c
|
|
index 3c0527c2bf..0dab507b71 100644
|
|
--- a/block/linux-aio.c
|
|
+++ b/block/linux-aio.c
|
|
@@ -28,6 +28,9 @@
|
|
*/
|
|
#define MAX_EVENTS 1024
|
|
|
|
+/* Maximum number of requests in a batch. (default value) */
|
|
+#define DEFAULT_MAX_BATCH 32
|
|
+
|
|
struct qemu_laiocb {
|
|
Coroutine *co;
|
|
LinuxAioState *ctx;
|
|
@@ -351,6 +354,10 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
|
|
LinuxAioState *s = laiocb->ctx;
|
|
struct iocb *iocbs = &laiocb->iocb;
|
|
QEMUIOVector *qiov = laiocb->qiov;
|
|
+ int64_t max_batch = s->aio_context->aio_max_batch ?: DEFAULT_MAX_BATCH;
|
|
+
|
|
+ /* limit the batch with the number of available events */
|
|
+ max_batch = MIN_NON_ZERO(MAX_EVENTS - s->io_q.in_flight, max_batch);
|
|
|
|
switch (type) {
|
|
case QEMU_AIO_WRITE:
|
|
@@ -371,7 +378,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
|
|
s->io_q.in_queue++;
|
|
if (!s->io_q.blocked &&
|
|
(!s->io_q.plugged ||
|
|
- s->io_q.in_flight + s->io_q.in_queue >= MAX_EVENTS)) {
|
|
+ s->io_q.in_queue >= max_batch)) {
|
|
ioq_submit(s);
|
|
}
|
|
|
|
--
|
|
2.27.0
|
|
|