Google
  Web www.spinics.net

Re: [PATCH 1/1] Use RCU for the UDP hash lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Jarek Poplawski wrote:
On Thu, Sep 25, 2008 at 10:18:33PM -0500, Corey Minyard wrote:
...
This patch is the second try; I believe I fixed all issues that people
raised.

Actually, you've skipped my first question, so I still don't know, why
you don't use an _init version of sk_del_node (even if it's safe in the
current implementation), while the non-rcu code uses only this?
I guess it didn't matter, but it doesn't matter and consistency is important, so I've changed it.

-corey

...
diff --git a/include/net/sock.h b/include/net/sock.h
index 06c5259..65110a6 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
...
 static inline int sk_unhashed(const struct sock *sk)
 {
 	return hlist_unhashed(&sk->sk_node);
@@ -361,6 +374,27 @@ static __inline__ int sk_del_node_init(struct sock *sk)
 	return rc;
 }
+static inline int __sk_del_node_rcu(struct sock *sk)
+{
+	if (sk_hashed(sk)) {
+		hlist_del_rcu(&sk->sk_node);
+		return 1;
+	}
+	return 0;
+}
+
+static inline int sk_del_node_rcu(struct sock *sk)
+{
+	int rc = __sk_del_node_rcu(sk);
+
+	if (rc) {
+		/* paranoid for a while -acme */
+		WARN_ON(atomic_read(&sk->sk_refcnt) == 1);
+		__sock_put(sk);
+	}
+	return rc;
+}
...

Jarek P.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Kernel List]     [Site Home]     [Ethernet Bridging]     [Git]     [IETF Annouce]     [Linux Assembly]     [VLAN]     [Networking]     [Security]     [Bugtraq]     [Rubini]     [Photo]     [Singles Social Netowrking]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Virtualization]     [Linux Security]     [Linux IDE]     [Linux RAID]     [Linux SCSI]     [Linux Wireless]     [DDR & Rambus]     [Free Dating]     [Linux Resources]     [Wireless Reading Device]

Add to Google Powered by Linux