]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
inet_diag: Add empty bucket optimization to inet_diag too
authorAndi Kleen <ak@linux.intel.com>
Thu, 28 Aug 2008 08:09:54 +0000 (01:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Aug 2008 08:09:54 +0000 (01:09 -0700)
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>
net/ipv4/inet_diag.c

index c10036e7a46349130d3a27c16c0a341795581d27..89cb047ab31436d42a6f2dd8cf0e0c7a70c438f1 100644 (file)
@@ -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);