[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/6] migration/multifd: use boolean for pending_job
From: |
Wei Yang |
Subject: |
[Qemu-devel] [PATCH 5/6] migration/multifd: use boolean for pending_job is enough |
Date: |
Thu, 6 Jun 2019 16:35:00 +0800 |
After synchronization request is handled in another case, there only
could be one pending_job for one send thread at most.
This is fine to use boolean to represent this behavior.
Signed-off-by: Wei Yang <address@hidden>
---
migration/ram.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 3e48795608..831b15833b 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -645,7 +645,7 @@ typedef struct {
/* should this thread finish */
bool quit;
/* thread has work to do */
- int pending_job;
+ bool pending_job;
/* array of pages to sent */
MultiFDPages_t *pages;
/* packet allocated len */
@@ -942,7 +942,7 @@ static void multifd_send_pages(void)
qemu_mutex_lock(&p->mutex);
if (!p->pending_job) {
- p->pending_job++;
+ p->pending_job = true;
next_channel = (i + 1) % migrate_multifd_channels();
break;
}
@@ -1126,7 +1126,7 @@ static void *multifd_send_thread(void *opaque)
}
qemu_mutex_lock(&p->mutex);
- p->pending_job--;
+ p->pending_job = false;
qemu_mutex_unlock(&p->mutex);
qemu_sem_post(&multifd_send_state->channels_ready);
@@ -1213,8 +1213,7 @@ int multifd_save_setup(void)
qemu_mutex_init(&p->mutex);
qemu_sem_init(&p->sem, 0);
- p->sync = p->quit = false;
- p->pending_job = 0;
+ p->sync = p->quit = p->pending_job = false;
p->id = i;
p->pages = multifd_pages_init(page_count);
p->packet_len = sizeof(MultiFDPacket_t)
--
2.19.1
- [Qemu-devel] [PATCH 0/6] multifd: a new mechanism for send thread sync, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 2/6] migration/multifd: notify channels_ready when send thread starts, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 4/6] migration/multifd: used must not be 0 for a pending job, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 5/6] migration/multifd: use boolean for pending_job is enough,
Wei Yang <=
- [Qemu-devel] [PATCH 3/6] migration/multifd: use sync field to synchronize send threads, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 1/6] migration/multifd: move MultiFDSendParams handling into multifd_send_fill_packet(), Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 6/6] migration/multifd: there is no spurious wakeup now, Wei Yang, 2019/06/06