summary refs log tree commit diff stats
path: root/include/qemu/queue.h
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@tencent.com>2018-08-21 16:10:25 +0800
committerJuan Quintela <quintela@redhat.com>2018-08-22 12:36:18 +0200
commitae526e32bd36cfb84045c8d2fd34e0b9e39a52f8 (patch)
treebd6083598307d47aec30506bfe26b7ec0fe4ece5 /include/qemu/queue.h
parent5e5fdcff28ebbba2004c6498218f506f364f1e8a (diff)
downloadfocaccia-qemu-ae526e32bd36cfb84045c8d2fd34e0b9e39a52f8.tar.gz
focaccia-qemu-ae526e32bd36cfb84045c8d2fd34e0b9e39a52f8.zip
migration: hold the lock only if it is really needed
Try to hold src_page_req_mutex only if the queue is not
empty

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'include/qemu/queue.h')
-rw-r--r--include/qemu/queue.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 59fd1203a1..ac418efc43 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -341,6 +341,7 @@ struct {                                                                \
 /*
  * Simple queue access methods.
  */
+#define QSIMPLEQ_EMPTY_ATOMIC(head) (atomic_read(&((head)->sqh_first)) == NULL)
 #define QSIMPLEQ_EMPTY(head)        ((head)->sqh_first == NULL)
 #define QSIMPLEQ_FIRST(head)        ((head)->sqh_first)
 #define QSIMPLEQ_NEXT(elm, field)   ((elm)->field.sqe_next)