Subject: Re: [RFC net-next-2.6] can: replace spinlocks with mutexes

From: Oliver Hartkopp <[email-masked]>
Date: Wed, 20 Apr 2011 18:18:40 +0200

On 20.04.2011 17:39, Eric Dumazet wrote:
> Le mercredi 20 avril 2011 à 17:31 +0200, Oliver Hartkopp a écrit :
>> This patch removes spinlocks for the CAN netdevice specific receive lists.
>> The RCU-based receive lists can be modified from process context or from the
>> netdevice notifier call. As both might sleep we can safely replace the
>> spinlocks with mutexes.
>>
>> Signed-off-by: Oliver Hartkopp <[email-masked]>
>>
>> ---
> 
> But... why ?
> 
> A spinlock is faster/smaller than a mutex.

Hm, i expected the mutex to have some advantages especially in multicore
systems ...

But if it doesn't has any vital advantage, we can leave it as-is.

> Maybe you wanted to _remove_ spinlock, since/if writer hold RTNL and
> doesnt need to exclude another writer(s) ?

That's an interesting idea. The filters are modified at socket
creation/removal time and can also be modified in between using sockopts by
_ordinary_ users. Could that be a problem?

> Note : I did not check the RTNL assertion, you might add appropriate
> ASSERT_RTNL() calls just to be 100% safe.

I'll investigate some similar places in the networking code and then replace
the spinlocks with rtnl_locks for some testing.

Thanks for the feedback,
Oliver