From: Akinobu Mita Date: Thu, 31 Aug 2006 22:21:50 +0000 (-0700) Subject: [NET]: Rate limiting for socket allocation failure messages. X-Git-Tag: v2.6.18-rc6~29 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=5991c84421f3ea1e281954610a39e4993e5c39e4;p=~shefty%2Frdma-dev.git [NET]: Rate limiting for socket allocation failure messages. This patch limits the warning messages when socket allocation failures happen. It happens under memory pressure. Signed-off-by: Akinobu Mita Signed-off-by: David S. Miller --- diff --git a/net/socket.c b/net/socket.c index b4848ce0d6a..6d261bf206f 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1178,7 +1178,8 @@ static int __sock_create(int family, int type, int protocol, struct socket **res */ if (!(sock = sock_alloc())) { - printk(KERN_WARNING "socket: no more sockets\n"); + if (net_ratelimit()) + printk(KERN_WARNING "socket: no more sockets\n"); err = -ENFILE; /* Not exactly a match, but its the closest posix thing */ goto out;