Skip to content

Commit

Permalink
inet_diag: Add empty bucket optimization to inet_diag too
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andi Kleen authored and David S. Miller committed Aug 28, 2008
1 parent 6eac560 commit 6be547a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/ipv4/inet_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 6be547a

Please sign in to comment.