From: Kevin Wolf <kwolf@redhat.com>
To: Bin Guo <guobin@linux.alibaba.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [PATCH] util/qemu-coroutine: skip global pool lock when pool is empty
Date: Fri, 29 May 2026 15:39:34 +0200 [thread overview]
Message-ID: <ahmXFt7AtoyClZui@redhat.com> (raw)
In-Reply-To: <20260529015423.49688-1-guobin@linux.alibaba.com>
Am 29.05.2026 um 03:54 hat Bin Guo geschrieben:
> coroutine_pool_refill_local() acquires global_pool_lock on every
> call even when the global pool is empty (global_pool_size == 0).
> Under high I/O concurrency many threads simultaneously attempt to
> refill from an empty global pool, causing unnecessary mutex
> contention.
>
> Add a fast-path check: read global_pool_size with qatomic_read()
> before acquiring the mutex. If zero, the global pool is empty and
> we return immediately. This is a racy read but correctness is
> preserved: the only consequence of a stale read is a missed refill
> opportunity, which will be retried on the next coroutine allocation.
>
> Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
If you have any benchmark results, putting them in the commit message
would be a good idea. (If you don't have them, you should probably get
them for a patch that is motivated by performance.)
Kevin
prev parent reply other threads:[~2026-05-29 13:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 1:54 [PATCH] util/qemu-coroutine: skip global pool lock when pool is empty Bin Guo
2026-05-29 8:34 ` Paolo Bonzini
2026-05-29 13:39 ` Kevin Wolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ahmXFt7AtoyClZui@redhat.com \
--to=kwolf@redhat.com \
--cc=guobin@linux.alibaba.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.