From: Eric Dumazet <eduma...@google.com>

On loaded TCP servers, looking at millions of sockets can hold
cpu for many seconds, if the lookup condition is very narrow.

(eg : ss dst 1.2.3.4 )

Better add a cond_resched() to allow other processes to access
the cpu.

Signed-off-by: Eric Dumazet <eduma...@google.com>
---
 net/ipv4/inet_diag.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 6029157..7883473 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -879,6 +879,7 @@ next_normal:
                }
 
                spin_unlock_bh(lock);
+               cond_resched();
        }
 
 done:


Reply via email to