提交 6be547a6 编写于 作者: A Andi Kleen 提交者: David S. Miller

inet_diag: Add empty bucket optimization to inet_diag too

Skip quickly over empty buckets in inet_diag.
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6eac5604
...@@ -782,11 +782,15 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -782,11 +782,15 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
struct sock *sk; struct sock *sk;
struct hlist_node *node; struct hlist_node *node;
num = 0;
if (hlist_empty(&head->chain) && hlist_empty(&head->twchain))
continue;
if (i > s_i) if (i > s_i)
s_num = 0; s_num = 0;
read_lock_bh(lock); read_lock_bh(lock);
num = 0;
sk_for_each(sk, node, &head->chain) { sk_for_each(sk, node, &head->chain) {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部