[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] coroutine: switch per-thread free pool to a glo
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] coroutine: switch per-thread free pool to a global pool |
Date: |
Tue, 6 Dec 2011 13:25:40 +0000 |
On Mon, Dec 5, 2011 at 5:20 PM, Avi Kivity <address@hidden> wrote:
> 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.
Looks good to me. I did check how hw/9pfs/ uses coroutines because it
bounces them into worker threads that are not under the QEMU mutex but
they are not created/destroyed there so we should be okay.
Stefan