diff options
| author | Xiao Guangrong | 2018-08-21 10:10:25 +0200 |
|---|---|---|
| committer | Juan Quintela | 2018-08-22 12:36:18 +0200 |
| commit | ae526e32bd36cfb84045c8d2fd34e0b9e39a52f8 (patch) | |
| tree | bd6083598307d47aec30506bfe26b7ec0fe4ece5 /migration | |
| parent | migration: move handle of zero page to the thread (diff) | |
| download | qemu-ae526e32bd36cfb84045c8d2fd34e0b9e39a52f8.tar.gz qemu-ae526e32bd36cfb84045c8d2fd34e0b9e39a52f8.tar.xz 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 'migration')
| -rw-r--r-- | migration/ram.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/migration/ram.c b/migration/ram.c index 40013e68a1..79c89425a3 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2033,6 +2033,10 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset) { RAMBlock *block = NULL; + if (QSIMPLEQ_EMPTY_ATOMIC(&rs->src_page_requests)) { + return NULL; + } + qemu_mutex_lock(&rs->src_page_req_mutex); if (!QSIMPLEQ_EMPTY(&rs->src_page_requests)) { struct RAMSrcPageRequest *entry = |
