diff options
author | Mikolaj Golub <trociny@FreeBSD.org> | 2013-12-10 20:06:41 +0000 |
---|---|---|
committer | Mikolaj Golub <trociny@FreeBSD.org> | 2013-12-10 20:06:41 +0000 |
commit | 9c539971148b466f8331594294ba8b4a44e7c7db (patch) | |
tree | 9b30fe69420145e1da623ef70af6d1095ddfc0f1 /sbin/hastd/secondary.c | |
parent | d685f88bee3a0f6ccd521b169ceb5711dd41781f (diff) | |
download | src-9c539971148b466f8331594294ba8b4a44e7c7db.tar.gz src-9c539971148b466f8331594294ba8b4a44e7c7db.zip |
Send wakeup to threads waiting on empty queue before releasing the
lock to decrease spurious wakeups.
Submitted by: davidxu
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=259195
Diffstat (limited to 'sbin/hastd/secondary.c')
-rw-r--r-- | sbin/hastd/secondary.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sbin/hastd/secondary.c b/sbin/hastd/secondary.c index 899ee92d0ab6..5e1207a35677 100644 --- a/sbin/hastd/secondary.c +++ b/sbin/hastd/secondary.c @@ -110,15 +110,12 @@ static void *disk_thread(void *arg); static void *send_thread(void *arg); #define QUEUE_INSERT(name, hio) do { \ - bool _wakeup; \ - \ mtx_lock(&hio_##name##_list_lock); \ - _wakeup = TAILQ_EMPTY(&hio_##name##_list); \ + if (TAILQ_EMPTY(&hio_##name##_list)) \ + cv_broadcast(&hio_##name##_list_cond); \ TAILQ_INSERT_TAIL(&hio_##name##_list, (hio), hio_next); \ hio_##name##_list_size++; \ mtx_unlock(&hio_##name##_list_lock); \ - if (_wakeup) \ - cv_broadcast(&hio_##name##_list_cond); \ } while (0) #define QUEUE_TAKE(name, hio) do { \ mtx_lock(&hio_##name##_list_lock); \ |