On Thu, 02/05 09:37, Paolo Bonzini wrote:
> 
> 
> On 05/02/2015 07:23, Fam Zheng wrote:
> >> > @@ -1381,14 +1397,16 @@ static ram_addr_t ram_block_add(RAMBlock 
> >> > *new_block, Error **errp)
> >> >          QTAILQ_INSERT_TAIL(&ram_list.blocks, new_block, next);
> >> >      }
> >> >      ram_list.mru_block = NULL;
> >> > +    atomic_rcu_set(&ram_list.version, ram_list.version + 1);
> >> >  
> >> > -    ram_list.version++;
> > Why is this not atomic_inc
> 
> Because writes are protected by the ramlist lock.  atomic_inc is more
> expensive.

OK!

> 
> > (or why is atomic_rcu_set necessary here)?
> 
> I probably should move it to patch 9; it is needed to update the list
> before ram_list.version.
> 
> If you prefer I can change it to
> 
>       smp_wmb();
>       atomic_set(&ram_list.version, ram_list.version + 1);
> 
> ?
> 

Yes, this looks more obvious :)

Fam

Reply via email to