[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 11/17] migration: Really use multiple pages a
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH v5 11/17] migration: Really use multiple pages at a time |
Date: |
Tue, 08 Aug 2017 18:06:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Peter Xu <address@hidden> wrote:
> On Mon, Jul 17, 2017 at 03:42:32PM +0200, Juan Quintela wrote:
>
> [...]
>
>> static int multifd_send_page(uint8_t *address)
>> {
>> - int i;
>> + int i, j;
>> MultiFDSendParams *p = NULL; /* make happy gcc */
>> + static multifd_pages_t pages;
>> + static bool once;
>> +
>> + if (!once) {
>> + multifd_init_group(&pages);
>> + once = true;
>
> Would it be good to put the "pages" into multifd_send_state? One is to
> stick globals together; another benefit is that we can remove the
> "once" here: we can then init the "pages" when init multifd_send_state
> struct (but maybe with a better name?...).
I did to be able to free it.
> (there are similar static variables in multifd_recv_page() as well, if
> this one applies, then we can possibly use multifd_recv_state for
> that one)
Also there.
>> + }
>> +
>> + pages.iov[pages.num].iov_base = address;
>> + pages.iov[pages.num].iov_len = TARGET_PAGE_SIZE;
>> + pages.num++;
>> +
>> + if (pages.num < (pages.size - 1)) {
>> + return UINT16_MAX;
>
> Nit: shall we define something for readability? Like:
>
> #define MULTIFD_FD_INVALID UINT16_MAX
Also done.
MULTIFD_CONTINUE
But I am open to changes.
>> + }
>>
>> qemu_sem_wait(&multifd_send_state->sem);
>> qemu_mutex_lock(&multifd_send_state->mutex);
>> @@ -530,7 +559,12 @@ static int multifd_send_page(uint8_t *address)
>> }
>> qemu_mutex_unlock(&multifd_send_state->mutex);
>> qemu_mutex_lock(&p->mutex);
>> - p->address = address;
>> + p->pages.num = pages.num;
>> + for (j = 0; j < pages.size; j++) {
>> + p->pages.iov[j].iov_base = pages.iov[j].iov_base;
>> + p->pages.iov[j].iov_len = pages.iov[j].iov_len;
>> + }
>> + pages.num = 0;
>> qemu_mutex_unlock(&p->mutex);
>> qemu_sem_post(&p->sem);
>>
>> --
>> 2.9.4
>>