[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuL
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt |
Date: |
Tue, 29 Nov 2016 13:34:07 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 11/29/2016 05:46 AM, Paolo Bonzini wrote:
> A QemuLockCnt comprises a counter and a mutex, with primitives
> to increment and decrement the counter, and to take and release the
> mutex. It can be used to do lock-free visits to a data structure
> whenever mutexes would be too heavy-weight and the critical section
> is too long for RCU.
>
> This could be implemented simply by protecting the counter with the
> mutex, but QemuLockCnt is harder to misuse and more efficient.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> + int qemu_lockcnt_count(QemuLockCnt *lockcnt);
> +
> + Return the lockcnt's count. The count can change at any time
> + any time; still, while the lockcnt is locked, one can usefully
duplicate 'any time'
> +++ b/util/lockcnt.c
> @@ -0,0 +1,113 @@
> +/*
> + * QemuLockCnt implementation
> + *
> + * Copyright Red Hat, Inc. 2015
You've been sitting on this a while :) Want to add 2016?
The documentation is a huge help to understanding the code; overall it
looks pretty clean.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH for-2.9 00/10] aio_context_acquire/release pushdown, part 1, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 01/10] aio: rename bh_lock to list_lock, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 03/10] aio: make ctx->list_lock a QemuLockCnt, subsuming ctx->walking_bh, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 02/10] qemu-thread: introduce QemuLockCnt, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 08/10] aio: document locking, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 09/10] aio: push aio_context_acquire/release down to dispatching, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 05/10] aio: tweak walking in dispatch phase, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 10/10] async: optimize aio_bh_poll, Paolo Bonzini, 2016/11/29
- [Qemu-block] [PATCH 06/10] aio-posix: remove walking_handlers, protecting AioHandler list with list_lock, Paolo Bonzini, 2016/11/29