diff options
author | Octavian Purdila <opurdila@ixiacom.com> | 2009-12-26 06:51:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-26 23:41:43 -0500 |
commit | b76f5a8427ac2928c07fa4ff2144bb8db072c240 (patch) | |
tree | 542d64a8bd28baf69f87b199a0156f865a06551d /include | |
parent | abf9d537fea225af60762640361af7fb233b3103 (diff) |
llc: convert the socket list to RCU locking
For the reclamation phase we use the SLAB_DESTROY_BY_RCU mechanism,
which require some extra checks in the lookup code:
a) If the current socket was released, reallocated & inserted in
another list it will short circuit the iteration for the current list,
thus we need to restart the lookup.
b) If the current socket was released, reallocated & inserted in the
same list we just need to recheck it matches the look-up criteria and
if not we can skip to the next element.
In this case there is no need to restart the lookup, since sockets are
inserted at the start of the list and the worst that will happen is
that we will iterate throught some of the list elements more then
once.
Note that the /proc and multicast delivery was not yet converted to
RCU, it still uses spinlocks for protection.
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/llc.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/net/llc.h b/include/net/llc.h index 7940da1606e7..1559cf10e874 100644 --- a/include/net/llc.h +++ b/include/net/llc.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/if_ether.h> | 16 | #include <linux/if_ether.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <linux/rculist_nulls.h> | ||
19 | 20 | ||
20 | #include <asm/atomic.h> | 21 | #include <asm/atomic.h> |
21 | 22 | ||
@@ -53,10 +54,8 @@ struct llc_sap { | |||
53 | struct net_device *orig_dev); | 54 | struct net_device *orig_dev); |
54 | struct llc_addr laddr; | 55 | struct llc_addr laddr; |
55 | struct list_head node; | 56 | struct list_head node; |
56 | struct { | 57 | spinlock_t sk_lock; |
57 | rwlock_t lock; | 58 | struct hlist_nulls_head sk_list; |
58 | struct hlist_head list; | ||
59 | } sk_list; | ||
60 | }; | 59 | }; |
61 | 60 | ||
62 | #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ | 61 | #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ |