]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0009-coroutine-Rename-qemu_coroutine_inc-dec_pool_size.patch
945947124561de9cb8866fe8a8b6828561f1095c
[pve-qemu.git] / debian / patches / extra / 0009-coroutine-Rename-qemu_coroutine_inc-dec_pool_size.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Kevin Wolf <kwolf@redhat.com>
3 Date: Tue, 10 May 2022 17:10:19 +0200
4 Subject: [PATCH] coroutine: Rename qemu_coroutine_inc/dec_pool_size()
5
6 It's true that these functions currently affect the batch size in which
7 coroutines are reused (i.e. moved from the global release pool to the
8 allocation pool of a specific thread), but this is a bug and will be
9 fixed in a separate patch.
10
11 In fact, the comment in the header file already just promises that it
12 influences the pool size, so reflect this in the name of the functions.
13 As a nice side effect, the shorter function name makes some line
14 wrapping unnecessary.
15
16 Cc: qemu-stable@nongnu.org
17 Signed-off-by: Kevin Wolf <kwolf@redhat.com>
18 Message-Id: <20220510151020.105528-2-kwolf@redhat.com>
19 Signed-off-by: Kevin Wolf <kwolf@redhat.com>
20 (cherry-picked from commit 98e3ab35054b946f7c2aba5408822532b0920b53)
21 Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
22 ---
23 hw/block/virtio-blk.c | 6 ++----
24 include/qemu/coroutine.h | 6 +++---
25 util/qemu-coroutine.c | 4 ++--
26 3 files changed, 7 insertions(+), 9 deletions(-)
27
28 diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
29 index 540c38f829..6a1cc41877 100644
30 --- a/hw/block/virtio-blk.c
31 +++ b/hw/block/virtio-blk.c
32 @@ -1215,8 +1215,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
33 for (i = 0; i < conf->num_queues; i++) {
34 virtio_add_queue(vdev, conf->queue_size, virtio_blk_handle_output);
35 }
36 - qemu_coroutine_increase_pool_batch_size(conf->num_queues * conf->queue_size
37 - / 2);
38 + qemu_coroutine_inc_pool_size(conf->num_queues * conf->queue_size / 2);
39 virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err);
40 if (err != NULL) {
41 error_propagate(errp, err);
42 @@ -1253,8 +1252,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev)
43 for (i = 0; i < conf->num_queues; i++) {
44 virtio_del_queue(vdev, i);
45 }
46 - qemu_coroutine_decrease_pool_batch_size(conf->num_queues * conf->queue_size
47 - / 2);
48 + qemu_coroutine_dec_pool_size(conf->num_queues * conf->queue_size / 2);
49 qemu_del_vm_change_state_handler(s->change);
50 blockdev_mark_auto_del(s->blk);
51 virtio_cleanup(vdev);
52 diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h
53 index c828a95ee0..5b621d1295 100644
54 --- a/include/qemu/coroutine.h
55 +++ b/include/qemu/coroutine.h
56 @@ -334,12 +334,12 @@ void coroutine_fn yield_until_fd_readable(int fd);
57 /**
58 * Increase coroutine pool size
59 */
60 -void qemu_coroutine_increase_pool_batch_size(unsigned int additional_pool_size);
61 +void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size);
62
63 /**
64 - * Devcrease coroutine pool size
65 + * Decrease coroutine pool size
66 */
67 -void qemu_coroutine_decrease_pool_batch_size(unsigned int additional_pool_size);
68 +void qemu_coroutine_dec_pool_size(unsigned int additional_pool_size);
69
70 #include "qemu/lockable.h"
71
72 diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
73 index f3e8300c8d..ea23929a74 100644
74 --- a/util/qemu-coroutine.c
75 +++ b/util/qemu-coroutine.c
76 @@ -212,12 +212,12 @@ AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co)
77 return co->ctx;
78 }
79
80 -void qemu_coroutine_increase_pool_batch_size(unsigned int additional_pool_size)
81 +void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size)
82 {
83 qatomic_add(&pool_batch_size, additional_pool_size);
84 }
85
86 -void qemu_coroutine_decrease_pool_batch_size(unsigned int removing_pool_size)
87 +void qemu_coroutine_dec_pool_size(unsigned int removing_pool_size)
88 {
89 qatomic_sub(&pool_batch_size, removing_pool_size);
90 }