summaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_diag.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2008-08-28 10:09:54 +0200
committerDavid S. Miller <davem@davemloft.net>2008-08-28 10:09:54 +0200
commit6be547a61d6220199826070cda792297c3d15994 (patch)
tree12e5b2bff9572519968677172fa5bed9b27ca489 /net/ipv4/inet_diag.c
parenttcp: Skip empty hash buckets faster in /proc/net/tcp (diff)
downloadlinux-6be547a61d6220199826070cda792297c3d15994.tar.xz
linux-6be547a61d6220199826070cda792297c3d15994.zip
inet_diag: Add empty bucket optimization to inet_diag too
Skip quickly over empty buckets in inet_diag. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r--net/ipv4/inet_diag.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index c10036e7a463..89cb047ab314 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -782,11 +782,15 @@ skip_listen_ht:
struct sock *sk;
struct hlist_node *node;
+ num = 0;
+
+ if (hlist_empty(&head->chain) && hlist_empty(&head->twchain))
+ continue;
+
if (i > s_i)
s_num = 0;
read_lock_bh(lock);
- num = 0;
sk_for_each(sk, node, &head->chain) {
struct inet_sock *inet = inet_sk(sk);