From nobody Mon Feb 9 21:21:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487007339845493.11427413414356; Mon, 13 Feb 2017 09:35:39 -0800 (PST) Received: from localhost ([::1]:58412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdKXI-0005dJ-60 for importer@patchew.org; Mon, 13 Feb 2017 12:35:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdKIS-00088A-22 for qemu-devel@nongnu.org; Mon, 13 Feb 2017 12:20:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdKIQ-00051d-Fg for qemu-devel@nongnu.org; Mon, 13 Feb 2017 12:20:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37354) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cdKIQ-00051H-5f for qemu-devel@nongnu.org; Mon, 13 Feb 2017 12:20:14 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 615D54E05D for ; Mon, 13 Feb 2017 17:20:14 +0000 (UTC) Received: from emacs.mitica (ovpn-117-176.ams2.redhat.com [10.36.117.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BB38306B3; Mon, 13 Feb 2017 17:20:13 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 13 Feb 2017 18:19:46 +0100 Message-Id: <1487006388-7966-11-git-send-email-quintela@redhat.com> In-Reply-To: <1487006388-7966-1-git-send-email-quintela@redhat.com> References: <1487006388-7966-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 13 Feb 2017 17:20:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/12] migration: Really use multiple pages at a time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amit.shah@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We now send several pages at a time each time that we wakeup a thread. Signed-off-by: Juan Quintela --- 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(¶ms->mutex); break; } - if (params->address) { - params->address =3D 0; + if (params->pages.num) { + params->pages.num =3D 0; qemu_mutex_unlock(¶ms->mutex); qemu_mutex_lock(&multifd_send_mutex); params->done =3D true; @@ -480,6 +487,13 @@ void migrate_multifd_send_threads_join(void) multifd_send =3D NULL; } +static void multifd_init_group(MultiFDPages *pages) +{ + pages->num =3D 0; + pages->size =3D migrate_multifd_group(); + pages->address =3D 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 =3D false; p->done =3D true; - p->address =3D 0; + multifd_init_group(&multifd_send[i].pages); p->c =3D 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 =3D true; + } + + pages.address[pages.num] =3D address; + pages.num++; + + if (pages.num < (pages.size - 1)) { + return UINT16_MAX; + } thread_count =3D 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 =3D address; + multifd_send[i].pages.num =3D pages.num; + for (j =3D 0; j < pages.size; j++) { + multifd_send[i].pages.address[j] =3D pages.address[j]; + } + pages.num =3D 0; qemu_mutex_unlock(&multifd_send[i].mutex); qemu_sem_post(&multifd_send[i].sem); --=20 2.7.4