[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 0/1] coroutine: avoid inserting duplicate coroutine to co_queu
From: |
Zhu Yangyang |
Subject: |
[PATCH v2 0/1] coroutine: avoid inserting duplicate coroutine to co_queue_wakeup |
Date: |
Mon, 1 Apr 2024 20:33:42 +0800 |
The problem that inserting duplicate coroutine to co_queue_wakeu has been
resolved by 7c1f51bf38 ("nbd/server: Fix drained_poll to wake coroutine
in right AioContext") that avoids repeatedly waking up the same coroutine.
The key modifications are as follows:
static void qio_channel_restart_read(void *opaque)
{
QIOChannel *ioc = opaque;
- Coroutine *co = ioc->read_coroutine;
+ Coroutine *co = qatomic_xchg(&ioc->read_coroutine, NULL);
+
+ if (!co) {
+ return;
+ }
/* Assert that aio_co_wake() reenters the coroutine directly */
assert(qemu_get_current_aio_context() ==
qemu_coroutine_get_aio_context(co));
aio_co_wake(co);
}
The root cause is that poll() is invoked in coroutine context, so fix it.
Changes in v2:
Drop the changes to aio_co_enter and instead fix the poll() call in the
nbd/server.
Zhu Yangyang (1):
nbd/server: do not poll within a coroutine context
nbd/client.c | 7 ++++---
nbd/common.c | 19 ++++++++++++++++---
nbd/nbd-internal.h | 6 +++---
nbd/server.c | 10 +++++-----
4 files changed, 28 insertions(+), 14 deletions(-)
--
2.33.0
- [PATCH v2 0/1] coroutine: avoid inserting duplicate coroutine to co_queue_wakeup,
Zhu Yangyang <=