Skip to contentSkip to conversation

IPV6: estalished connections are not shown with "cat /proc/net/tcp6"

PATCH David Miller 2 participants 3 messages Aug 29, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

From: Masayuki Nakagawa <[email protected]>
Date: Tue, 28 Aug 2007 18:41:38 -0700

Quoted 4 lines
(quoted diff) +4 -0
+static inline void __inet_hash_setbit(unsigned long *bitmask,
+	unsigned int index)
+{
+	if (bitmask)

Review

Quoted 10 lines
(quoted diff) +10 -0
+		set_bit(index, bitmask);
+}
+
+static inline void __inet_hash_clearbit(unsigned long *bitmask,
+	unsigned int index)
+{
+	if (bitmask)
+		clear_bit(index, bitmask);
+}
+

A new atomic operation every single socket hashing insert or delete operation is way too much amount of overhead for what should be a trivial problem.

Please fix this in another way that does not add new locks or atomics to the socket creation and destruction fast paths, thank you.

#2 lore raw

--
When I'm asked what language is my mother tongue,
I simply answer "C".

Quoted 13 lines · David Miller

From: Masayuki Nakagawa <[email protected]>
Date: Tue, 28 Aug 2007 18:41:38 -0700

Quoted 10 lines
(quoted diff) +10 -0
+static inline void __inet_hash_setbit(unsigned long *bitmask,
+	unsigned int index)
+{
+	if (bitmask)
+		set_bit(index, bitmask);
+}
+
+static inline void __inet_hash_clearbit(unsigned long *bitmask,
+	unsigned int index)
+{
Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+	if (bitmask)
+		clear_bit(index, bitmask);
+}
+

A new atomic operation every single socket hashing insert or delete operation is way too much amount of overhead for what should be a trivial problem.

Indeed it is.

Quoted 4 lines

Please fix this in another way that does not add new locks or atomics to the socket creation and destruction fast paths, thank you.

This was originally written back when there was a bh lock around the entire loop (IIRC). It caused quite a bit of latency problems back then.

I'll have to take a look to see if it is even still a problem.

If it is, then we'll need to find another fix for it. Unfortunately, it's not that trivial (if it is still a problem). Since we need a way to look a a large number of buckets without looping through checking each one.

Lee, I think you were the one to notice this source of latency back when it was first discovered. If I write a patch to back this out of the -rt kernel, could you see if it is still an issue?

Thanks,

-- Steve

#3 lore raw
In reply to a message not in the archive

--

Quoted 18 lines · Masayuki Nakagawa
Quoted 18 lines · Steven Rostedt
Quoted 9 lines
net/ipv4/tcp_ipv4.c 2007-06-17 17:20:27.000000000 +0200 renamed from net/ipv4/tcp_ipv4.c 2007-06-17 17:19:02.000000000 +0200 +0 -1
@@ -2033,7 +2033,12 @@ static void *established_get_first(struc
        struct tcp_iter_state* st = seq->private;
        void *rc = NULL;
 
-       for (st->bucket = 0; st->bucket < tcp_hashinfo.ehash_size; ++st->bucket) {
 
Quoted 4 lines

The above is a linear search through out a very large array, where most of the items are NULL. I believe it was Lee that noticed this creating a large latency. This was back in 2.6.14. I'll check to see if this still is a source of latency with the latest kernels.

It looks fairly generic, is it a latency that could be fix the same way up stream?

Quoted 8 lines
Quoted 2 lines

Daniel

Hi Steven,

I believe that we should push the following patch to upstream(netdev). (This is a patch which extracted a part of the hash code from real-time patch.) How do you think?

Hi Masayuki,

I really need to investigate if this is even still needed. This code was originally added when a bh lock was held for the entire for loop. I see that it is done per entry now. I'll take a look to see if there's a better way to do this.

Thanks for bringing this back to the fore front.

-- Steve