diff mbox

[net] net: diag: add a scheduling point in inet_diag_dump_icsk()

Message ID 1457995200.31401.28.camel@edumazet-glaptop3.roam.corp.google.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet March 14, 2016, 10:40 p.m. UTC
From: Eric Dumazet <edumazet@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 <edumazet@google.com>
---
 net/ipv4/inet_diag.c |    1 +
 1 file changed, 1 insertion(+)

Comments

David Miller March 14, 2016, 11:38 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 14 Mar 2016 15:40:00 -0700

> From: Eric Dumazet <edumazet@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 <edumazet@google.com>

Applied, thanks Eric.
diff mbox

Patch

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: