From: Andi Kleen Date: Thu, 28 Aug 2008 08:09:54 +0000 (-0700) Subject: inet_diag: Add empty bucket optimization to inet_diag too X-Git-Tag: v2.6.28-rc1~717^2~387 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=6be547a61d6220199826070cda792297c3d15994;p=linux-2.6-omap-h63xx.git inet_diag: Add empty bucket optimization to inet_diag too Skip quickly over empty buckets in inet_diag. Signed-off-by: Andi Kleen Signed-off-by: David S. Miller --- diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index c10036e7a46..89cb047ab31 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);