Skip to content

Commit

Permalink
[NET]: Rate limiting for socket allocation failure messages.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Akinobu Mita authored and David S. Miller committed Aug 31, 2006
1 parent 99c7bc0 commit 5991c84
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5991c84

Please sign in to comment.