qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 1/3] coroutine: introduce coroutines


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v4 1/3] coroutine: introduce coroutines
Date: Fri, 20 May 2011 13:32:51 +0100

On Fri, May 20, 2011 at 1:09 PM, Paolo Bonzini <address@hidden> wrote:
> On 05/20/2011 12:59 PM, Stefan Hajnoczi wrote:
>>
>> This coroutines implementation is based on the gtk-vnc implementation
>> written by Anthony Liguori<address@hidden>  but it has been
>> significantly rewritten by Kevin Wolf<address@hidden>  to use
>> setjmp()/longjmp() instead of the more expensive swapcontext() and by
>> Paolo Bonzini<address@hidden>  for Windows Fibers support.
>>
>
> Not a blocker at all, but why did you move the pooling to the ucontext
> implementation?  It's less expensive to create the fiber in Windows because
> there are no system calls (unlike swapcontext), but a future pthread-based
> implementation will also need the pooling.
>
> It can be left to whoever writes the pthread stuff, though.

There are two options for pooling:
1. Thread-local pools
2. One global pool with a lock

One of these choices must be selected because otherwise the pool could
be accessed simultaneously from multiple threads.  I tried #2 first
because it was less code but it caused a noticable slow-down with
./check-coroutine --benchmark-lifecycle.  Option #1 had less impact
but requires using thread-local storage, which I've used pthread APIs
for.  Hence I moved it into coroutine-ucontext.c hoping that win32
would either be fast enough as-as or that we could find a better
solution if someone needs it.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]