net: Convert TCP/DCCP listening hash tables to use RCU
This is the last step to be able to perform full RCU lookups in __inet_lookup() : After established/timewait tables, we add RCU lookups to listening hash table. The only trick here is that a socket of a given type (TCP ipv4, TCP ipv6, ...) can now flight between two different tables (established and listening) during a RCU grace period, so we must use different 'nulls' end-of-chain values for two tables. We define a large value : #define LISTENING_NULLS_BASE (1U << 29) So that slots in listening table are guaranteed to have different end-of-chain values than slots in established table. A reader can still detect it finished its lookup in the right chain. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
8c862c23e2
commit
c25eb3bfb9
@@ -720,13 +720,13 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
|
||||
for (i = s_i; i < INET_LHTABLE_SIZE; i++) {
|
||||
struct sock *sk;
|
||||
struct hlist_node *node;
|
||||
struct hlist_nulls_node *node;
|
||||
struct inet_listen_hashbucket *ilb;
|
||||
|
||||
num = 0;
|
||||
ilb = &hashinfo->listening_hash[i];
|
||||
spin_lock_bh(&ilb->lock);
|
||||
sk_for_each(sk, node, &ilb->head) {
|
||||
sk_nulls_for_each(sk, node, &ilb->head) {
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
|
||||
if (num < s_num) {
|
||||
|
Reference in New Issue
Block a user