[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 2/6] coroutine-lock: add limited spinning to CoM
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH 2/6] coroutine-lock: add limited spinning to CoMutex |
Date: |
Thu, 16 Feb 2017 16:10:07 +0000 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Mon, Feb 13, 2017 at 07:12:40PM +0100, Paolo Bonzini wrote:
> Running a very small critical section on pthread_mutex_t and CoMutex
> shows that pthread_mutex_t is much faster because it doesn't actually
> go to sleep. What happens is that the critical section is shorter
> than the latency of entering the kernel and thus FUTEX_WAIT always
> fails. With CoMutex there is no such latency but you still want to
> avoid wait and wakeup. So introduce it artificially.
>
> This only works with one waiters; because CoMutex is fair, it will
> always have more waits and wakeups than a pthread_mutex_t.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> include/qemu/coroutine.h | 5 +++++
> util/qemu-coroutine-lock.c | 51
> ++++++++++++++++++++++++++++++++++++++++------
> util/qemu-coroutine.c | 2 +-
> 3 files changed, 51 insertions(+), 7 deletions(-)
Reviewed-by: Stefan Hajnoczi <address@hidden>
signature.asc
Description: PGP signature
- [Qemu-block] [PATCH 0/6] Make CoMutex/CoQueue/CoRwlock thread-safe, Paolo Bonzini, 2017/02/13
- [Qemu-block] [PATCH 1/6] coroutine-lock: make CoMutex thread-safe, Paolo Bonzini, 2017/02/13
- [Qemu-block] [PATCH 2/6] coroutine-lock: add limited spinning to CoMutex, Paolo Bonzini, 2017/02/13
- Re: [Qemu-block] [PATCH 2/6] coroutine-lock: add limited spinning to CoMutex,
Stefan Hajnoczi <=
- [Qemu-block] [PATCH 3/6] test-aio-multithread: add performance comparison with thread-based mutexes, Paolo Bonzini, 2017/02/13
- [Qemu-block] [PATCH 4/6] coroutine-lock: place CoMutex before CoQueue in header, Paolo Bonzini, 2017/02/13
- [Qemu-block] [PATCH 5/6] coroutine-lock: add mutex argument to CoQueue APIs, Paolo Bonzini, 2017/02/13
- [Qemu-block] [PATCH 6/6] coroutine-lock: make CoRwlock thread-safe and fair, Paolo Bonzini, 2017/02/13
- Re: [Qemu-block] [PATCH 0/6] Make CoMutex/CoQueue/CoRwlock thread-safe, Fam Zheng, 2017/02/15
- Re: [Qemu-block] [PATCH 0/6] Make CoMutex/CoQueue/CoRwlock thread-safe, Stefan Hajnoczi, 2017/02/16