[PATCH] rate limiting for socket allocation failure messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Resending due to local mail server trouble)

This patch limits the warning messages when socket allocation
failures happen. It happens under memory pressure.

Cc: David Miller <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>

 net/socket.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: work-shouldfail/net/socket.c
===================================================================
--- work-shouldfail.orig/net/socket.c
+++ work-shouldfail/net/socket.c
@@ -1178,7 +1178,8 @@ static int __sock_create(int family, int
  */
 
 	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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux