Skip to content
Commit fe5c13eb authored by Avi Kivity's avatar Avi Kivity Committed by Justin M. Forbes
Browse files

coroutine: switch per-thread free pool to a global pool



ucontext-based coroutines use a free pool to reduce allocations and
deallocations of coroutine objects.  The pool is per-thread, presumably
to improve locality.  However, as coroutines are usually allocated in
a vcpu thread and freed in the I/O thread, the pool accounting gets
screwed up and we end allocating and freeing a coroutine for every I/O
request.  This is expensive since large objects are allocated via the
kernel, and are not cached by the C runtime.

Fix by switching to a global pool.  This is safe since we're protected
by the global mutex.

Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 6061f16a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment