[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200911061629.42911.remi.denis-courmont@nokia.com>
Date: Fri, 6 Nov 2009 16:29:42 +0200
From: "Rémi Denis-Courmont"
<remi.denis-courmont@...ia.com>
To: ext Eric Dumazet <eric.dumazet@...il.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] Phonet: use rwlock for sockets list
On Friday 06 November 2009 16:00:39 ext Eric Dumazet, you wrote:
> Rémi Denis-Courmont a écrit :
> > It seems better than a spinlock, assuming that sockets are
> > created/destroyed more seldom than they receive packets. And then
> > sk_for_each_rcu does not exist. I am sure there is a good reason for
> > that, though I wouldn't know. I guess I should try to use RCU hlist_nulls
> > then?
>
> spin_lock()/spin_unlock() is faster than read_lock()/read_unlock(), unless
> there is contention. (two atomic ops instead of one)
>
> So, unless you have a particular performance problem, it's actually
> better to use a spinlock.
>
> If you do have performance problem, a RCU conversion is better than rwlock.
> I can do RCU conversion if you ask me...
The most obvious current bottleneck is the sockets linked-list more so than
the locking scheme (RCU vs spinlock vs rwlock). I'll fix that soonish
regardless of the locking.
Then there is the devices lists. I did not want to clutter all net_device's
with a Phonet-specific pointer, since most devices aren't Phonet-capable. So
we have a linked-list for per-device data. There, I guess RCU would make
sense, but it did not seem trivial a change at all.
That said, there are no real "problems" yet - I was just trying to improve
things. N900 ships with the 2.6.30 Phonet stack, and it works fine :) The 3G
access network is typically the biggest bottleneck anyway...
So if you say R/W locks suck, screw this patch.
Thanks!
--
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists