qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, dgilbert@redhat.com
Subject: [Qemu-devel] [PULL 10/12] migration: Really use multiple pages at a time
Date: Mon, 13 Feb 2017 18:19:46 +0100	[thread overview]
Message-ID: <1487006388-7966-11-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1487006388-7966-1-git-send-email-quintela@redhat.com>

We now send several pages at a time each time that we wakeup a thread.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/ram.c | 44 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 38 insertions(+), 6 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index f7df6cb..8d85c49 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -391,6 +391,13 @@ void migrate_compress_threads_create(void)

 /* Multiple fd's */

+
+typedef struct {
+    int num;
+    int size;
+    uint8_t **address;
+} MultiFDPages;
+
 struct MultiFDSendParams {
     /* not changed */
     QemuThread thread;
@@ -400,7 +407,7 @@ struct MultiFDSendParams {
     QemuMutex mutex;
     /* protected by param mutex */
     bool quit;
-    uint8_t *address;
+    MultiFDPages pages;
     /* protected by multifd mutex */
     bool done;
 };
@@ -426,8 +433,8 @@ static void *multifd_send_thread(void *opaque)
             qemu_mutex_unlock(&params->mutex);
             break;
         }
-        if (params->address) {
-            params->address = 0;
+        if (params->pages.num) {
+            params->pages.num = 0;
             qemu_mutex_unlock(&params->mutex);
             qemu_mutex_lock(&multifd_send_mutex);
             params->done = true;
@@ -480,6 +487,13 @@ void migrate_multifd_send_threads_join(void)
     multifd_send = NULL;
 }

+static void multifd_init_group(MultiFDPages *pages)
+{
+    pages->num = 0;
+    pages->size = migrate_multifd_group();
+    pages->address = g_new0(uint8_t *, pages->size);
+}
+
 void migrate_multifd_send_threads_create(void)
 {
     int i, thread_count;
@@ -500,7 +514,7 @@ void migrate_multifd_send_threads_create(void)
         qemu_sem_init(&p->init, 0);
         p->quit = false;
         p->done = true;
-        p->address = 0;
+        multifd_init_group(&multifd_send[i].pages);
         p->c = socket_send_channel_create();
         if (!p->c) {
             error_report("Error creating a send channel");
@@ -515,7 +529,21 @@ void migrate_multifd_send_threads_create(void)

 static int multifd_send_page(uint8_t *address)
 {
-    int i, thread_count;
+    int i, j, thread_count;
+    static MultiFDPages pages;
+    static bool once;
+
+    if (!once) {
+        multifd_init_group(&pages);
+        once = true;
+    }
+
+    pages.address[pages.num] = address;
+    pages.num++;
+
+    if (pages.num < (pages.size - 1)) {
+        return UINT16_MAX;
+    }

     thread_count = migrate_multifd_threads();
     qemu_sem_wait(&multifd_send_sem);
@@ -528,7 +556,11 @@ static int multifd_send_page(uint8_t *address)
     }
     qemu_mutex_unlock(&multifd_send_mutex);
     qemu_mutex_lock(&multifd_send[i].mutex);
-    multifd_send[i].address = address;
+    multifd_send[i].pages.num = pages.num;
+    for (j = 0; j < pages.size; j++) {
+        multifd_send[i].pages.address[j] = pages.address[j];
+    }
+    pages.num = 0;
     qemu_mutex_unlock(&multifd_send[i].mutex);
     qemu_sem_post(&multifd_send[i].sem);

-- 
2.7.4

  parent reply	other threads:[~2017-02-13 17:20 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 17:19 [Qemu-devel] [PATCH 00/12] Multifd v4 Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 01/12] migration: Test for disabled features on reception Juan Quintela
2017-02-15 13:12   ` Dr. David Alan Gilbert
2017-02-13 17:19 ` [Qemu-devel] [PULL 02/12] migration: Don't create decompression threads if not enabled Juan Quintela
2017-02-15 13:17   ` Dr. David Alan Gilbert
2017-02-13 17:19 ` [Qemu-devel] [PULL 03/12] migration: Add multifd capability Juan Quintela
2017-02-15 13:04   ` Dr. David Alan Gilbert
2017-02-13 17:19 ` [Qemu-devel] [PULL 04/12] migration: Create x-multifd-threads parameter Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 05/12] migration: Create x-multifd-group parameter Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 06/12] migration: Create multifd migration threads Juan Quintela
2017-02-14 13:02   ` Paolo Bonzini
2017-02-13 17:19 ` [Qemu-devel] [PULL 07/12] migration: Start of multiple fd work Juan Quintela
2017-02-14 11:17   ` Daniel P. Berrange
2017-02-14 12:57   ` Paolo Bonzini
2017-02-14 13:12     ` Juan Quintela
2017-02-14 13:37       ` Paolo Bonzini
2017-02-14 13:52         ` Juan Quintela
2017-02-14 14:08           ` Paolo Bonzini
2017-02-13 17:19 ` [Qemu-devel] [PULL 08/12] migration: Create ram_multifd_page Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 09/12] migration: Create thread infrastructure for multifd send side Juan Quintela
2017-02-13 17:19 ` Juan Quintela [this message]
2017-02-13 17:19 ` [Qemu-devel] [PULL 11/12] migration: Send the fd number which we are going to use for this page Juan Quintela
2017-02-14 13:02   ` Paolo Bonzini
2017-02-14 13:16     ` Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 12/12] migration: Test new fd infrastructure Juan Quintela
2017-02-14  9:55 ` [Qemu-devel] [PATCH 00/12] Multifd v4 Peter Maydell
2017-02-14 12:38   ` Juan Quintela
2017-02-14 13:03 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487006388-7966-11-git-send-email-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).