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>
This commit is contained in:
Andi Kleen 2008-08-28 01:09:54 -07:00 committed by David S. Miller
parent 6eac560407
commit 6be547a61d

View File

@ -782,11 +782,15 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
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);