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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 5/9] exec: protect mru_block with RCU
Date: Thu, 05 Feb 2015 09:37:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0


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.

> (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);

?

Paolo



reply via email to

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