Subject: Re: Deadlock in IPv6 code while garbage collection on the rwlock protecting the routing tree.

From: Stephen Hemminger <[email-masked]>
Date: Wed, 23 Dec 2009 10:13:09 -0800

On Wed, 23 Dec 2009 12:44:31 -0500
Dave Johnson <[email-masked]> wrote:

> I don't think that would help.  You would still have a writer
> contained within a reader issue.  This would also likely involve quite
> a bit of copying given the amount of data the existing rwlock is
> protecting and how frequent write locks may be needed.

With RCU, you can safely acquire a spinlock inside rcu_read_lock
section.  The only issue is that the entry being modified might already
be in process of being deleted (ie. modifying a dead route).

Probably simpler to just get rid of rwlock entirely, go with a spinlock
for now.  Reader/writer locks are slower than spin locks and even if
lock is highly read contended, it is not held for long.

IPV6 routing table is using much simpler algorithms on the assumption
that IPV6 was going to solve the CIDR address explosion problem. That
assumption will probably not hold up, and having a trie (TRASH) version
of IPV6 routing table with RCU would be a good research project for
some graduate student.

--