[NET]: Rate limiting for socket allocation failure messages.
authorAkinobu Mita <mita@miraclelinux.com>
Thu, 31 Aug 2006 22:21:50 +0000 (15:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 Aug 2006 22:21:50 +0000 (15:21 -0700)
This patch limits the warning messages when socket allocation failures
happen. It happens under memory pressure.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/socket.c

index b4848ce0d6ac44718a5e970996031343fb85ee8f..6d261bf206fc83ff9aa5411a25273f53be7139d0 100644 (file)
@@ -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;