« Previous | Next » 

Revision 39a7a362

ID39a7a362e16bb27e98738d63f24d1ab5811e26a8

Added by Avi Kivity over 12 years ago

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: Avi Kivity <>
Signed-off-by: Kevin Wolf <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences