[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 10/17] migration: Create ram_multifd_page
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH v5 10/17] migration: Create ram_multifd_page |
Date: |
Tue, 08 Aug 2017 17:58:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
"Dr. David Alan Gilbert" <address@hidden> wrote:
> * Peter Xu (address@hidden) wrote:
>> On Wed, Jul 19, 2017 at 08:02:39PM +0100, Dr. David Alan Gilbert wrote:
>> ... here can we just do this?
>>
>> retry:
>> // don't take any lock, only read each p->address
>> for (i = 0; i < multifd_send_state->count; i++) {
>> p = &multifd_send_state->params[i];
>> if (!p->address) {
>> // we found one IDLE send thread
>> break;
>> }
>> }
>> if (!p) {
>> qemu_sem_wait(&multifd_send_state->sem);
>> goto retry;
>> }
>> // we switch its state, IDLE -> ACTIVE
>> atomic_set(&p->address, address);
>> // tell the thread to start work
>> qemu_sem_post(&p->sem);
>>
>> Above didn't really use any lock at all (either the per thread lock,
>> or the global lock). Would it work?
>
> I think what's there can certainly be simplified; but also note
> that the later patch gets rid of 'address' and turns it into a count.
> My suggest was to keep the 'done' and stop using 'address' as something
> special; i.e. never write address in the thread; but I think yours might
> work as well.
I substitute the test from address == 0 to page.num == 0.
Notice that this is temporal, just to check that I am doing the things
right. we end sending the pages here.
Later, Juan.