public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp•net>
To: Eric Dumazet <eric.dumazet@gmail•com>
Cc: David Miller <davem@davemloft•net>,
	Linux Netdev List <netdev@vger•kernel.org>,
	Kurt Van Dijck <kurt.van.dijck@eia•be>,
	Urs Thuermann <urs@isnogud•escape.de>
Subject: Re: [RFC net-next-2.6] can: replace spinlocks with mutexes
Date: Wed, 20 Apr 2011 18:18:40 +0200	[thread overview]
Message-ID: <4DAF0760.6000904@hartkopp.net> (raw)
In-Reply-To: <1303313954.3186.117.camel@edumazet-laptop>

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 <socketcan@hartkopp•net>
>>
>> ---
> 
> 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


  reply	other threads:[~2011-04-20 16:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-20 15:31 [RFC net-next-2.6] can: replace spinlocks with mutexes Oliver Hartkopp
2011-04-20 15:39 ` Eric Dumazet
2011-04-20 16:18   ` Oliver Hartkopp [this message]
2011-04-21 13:00   ` Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DAF0760.6000904@hartkopp.net \
    --to=socketcan@hartkopp$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=kurt.van.dijck@eia$(echo .)be \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=urs@isnogud$(echo .)escape.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox