qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 5/9] exec: protect mru_block with RCU


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH 5/9] exec: protect mru_block with RCU
Date: Thu, 5 Feb 2015 17:30:55 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

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

[Prev in Thread] Current Thread [Next in Thread]