On Wed, 19 Jul 2006 13:01:50 -0700 (PDT)
David Miller <[EMAIL PROTECTED]> wrote:

> From: Stephen Hemminger <[EMAIL PROTECTED]>
> Date: Wed, 19 Jul 2006 15:52:04 -0400
> 
> > As a related note, I am looking into fixing inet hash tables to use RCU.
> 
> IBM had posted a patch a long time ago, which would be not
> so hard to munge into the current tree.  See if you can
> spot it in the archives :)

Srivatsa Vaddagiri from IBM did  patch: http://lkml.org/lkml/2004/8/31/129

And Ben had a patch: http://lwn.net/Articles/174596/

Srivata's was more complete but pre-dates Acme's rearrangement.
Also, there is some code for refcnt's in it that looks wrong.
Or at minimum is masking underlying design flaws.

/* Ungrab socket and destroy it, if it was the last reference. */
 static inline void sock_put(struct sock *sk)
 {
-       if (atomic_dec_and_test(&sk->sk_refcnt))
-               sk_free(sk);
+sp_loop:
+       if (atomic_dec_and_test(&sk->sk_refcnt)) {
+               /* Restore ref count and schedule callback.
+                * If we don't restore ref count, then the callback can be
+                * scheduled by more than one CPU.
+                */
+               atomic_inc(&sk->sk_refcnt);
+
+               if (atomic_read(&sk->sk_refcnt) == 1)
+                       call_rcu(&sk->sk_rcu, sk_free_rcu);
+               else
+                       goto sp_loop;
+       }
 }

Ben's still left reader writer locks, and needed IPV6 work. He said he
plans to get back to it.


-- 
Stephen Hemminger <[EMAIL PROTECTED]>
"And in the Packet there writ down that doome"
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to