diff options
author | Andi Kleen <ak@linux.intel.com> | 2008-08-28 04:09:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-28 04:09:54 -0400 |
commit | 6be547a61d6220199826070cda792297c3d15994 (patch) | |
tree | 12e5b2bff9572519968677172fa5bed9b27ca489 /net | |
parent | 6eac56040787c3ff604fe7d48bbbb7897cd1387c (diff) |
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')
-rw-r--r-- | net/ipv4/inet_diag.c | 6 |
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: | |||
782 | struct sock *sk; | 782 | struct sock *sk; |
783 | struct hlist_node *node; | 783 | struct hlist_node *node; |
784 | 784 | ||
785 | num = 0; | ||
786 | |||
787 | if (hlist_empty(&head->chain) && hlist_empty(&head->twchain)) | ||
788 | continue; | ||
789 | |||
785 | if (i > s_i) | 790 | if (i > s_i) |
786 | s_num = 0; | 791 | s_num = 0; |
787 | 792 | ||
788 | read_lock_bh(lock); | 793 | read_lock_bh(lock); |
789 | num = 0; | ||
790 | sk_for_each(sk, node, &head->chain) { | 794 | sk_for_each(sk, node, &head->chain) { |
791 | struct inet_sock *inet = inet_sk(sk); | 795 | struct inet_sock *inet = inet_sk(sk); |
792 | 796 | ||