Re: [tipc-discussion] [PATCH net/tipc] Replace rcu_swap_protected() with rcu_replace_pointer()

From: Ying Xue
Date: Tue Dec 10 2019 - 23:55:45 EST


On 12/11/19 10:00 AM, Tuong Lien Tong wrote:
>>
>> /* Move passive key if any */
>> if (key.passive) {
>> - tipc_aead_rcu_swap(rx->aead[key.passive], tmp2, &rx->lock);
>> + tmp2 = rcu_replace_pointer(rx->aead[key.passive], tmp2,
> &rx->lock);
> The 3rd parameter should be the lockdep condition checking instead of the
> spinlock's pointer i.e. "lockdep_is_held(&rx->lock)"?
> That's why I'd prefer to use the 'tipc_aead_rcu_swap ()' macro, which is
> clear & concise at least for the context here. It might be re-used later as
> well...
>

Right. The 3rd parameter of rcu_replace_pointer() should be
"lockdep_is_held(&rx->lock)" instead of "&rx->lock".