Re: test7-pre4 tcp memory pressure

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

 



On Tue, Aug 29, 2000 at 08:53:23AM +0200, Patrick Schaaf wrote:
> >    However, I'd be glad if you could tell me why my writes block that
> >    long.  I'm certainly under 128MB of socket buffers, so the limits
> >    (on my 1GB machine) should not be reached.
> > 
> > How certain are you?

100%.

- I instrumented tcp_mem_schedule() with net_ratelimited printk()s in
  all pressure / failure cases, and nothing is printed.
- the machine was freshly booted, and received 1000 connections serving
  48kB each. All write()s took about 50ms.
- the same machine and same test, under 2.2.17pre18, works fine, with
  the writes taking about 0.5ms.
- next, I set /proc/sys/net/ipv4/tcp_wmem to '65536 65536 131072',
  without a change in result.
- next, I added a ratelimited printk to wait_for_tcp_memory(),
  the only place I see in the write path which goes to sleep.
  And indeed, this one triggers regularly. Tried again with tcp_wmem
  set as above, and it triggers just as often.
  (just checked by reading SO_SNDBUF in my server, it is indeed shown
  as 65536 byte)

What now?

best regards
  Patrick
  
--- jake.2.4.0-test7-pre4-ippool/net/ipv4/tcp.c	Fri Aug 18 08:22:48 2000
+++ jake.with.ank/net/ipv4/tcp.c	Tue Aug 29 13:12:07 2000
@@ -460,20 +460,31 @@
 
 	/* Under limit. */
 	if (atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) {
-		if (tcp_memory_pressure)
+		if (tcp_memory_pressure) {
 			tcp_memory_pressure = 0;
+			if (net_ratelimit())
+				printk(KERN_INFO "TCP: memory pressure is over, %d pages allocated\n",
+				atomic_read(&tcp_memory_allocated));
+			}
 		return 1;
 	}
 
 	/* Over hard limit. */
 	if (atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]) {
+		if (net_ratelimit())
+			printk(KERN_INFO "TCP: under hard pressure, %d pages allocated\n",
+			atomic_read(&tcp_memory_allocated));
 		tcp_enter_memory_pressure();
 		goto suppress_allocation;
 	}
 
 	/* Under pressure. */
-	if (atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[1])
+	if (atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[1]) {
+		if (net_ratelimit())
+			printk(KERN_INFO "TCP: coming under pressure, %d pages allocated\n",
+			atomic_read(&tcp_memory_allocated));
 		tcp_enter_memory_pressure();
+	}
 
 	if (kind) {
 		if (atomic_read(&sk->rmem_alloc) < sysctl_tcp_rmem[0])
@@ -492,6 +503,8 @@
 suppress_allocation:
 
 	if (kind == 0) {
+		if (net_ratelimit())
+			printk(KERN_INFO "TCP: moderating sndbuf\n");
 		tcp_moderate_sndbuf(sk);
 
 		/* Fail only if socket is _under_ its sndbuf.
@@ -499,6 +512,8 @@
 		 */
 		if (sk->wmem_queued+size >= sk->sndbuf)
 			return 1;
+		if (net_ratelimit())
+			printk(KERN_INFO "TCP: moderated sndbuf, must fail\n");
 	}
 
 	/* Alas. Undo changes. */
@@ -853,6 +868,9 @@
 		current_timeo = vm_wait = (net_random()%(HZ/5))+2;
 
 	clear_bit(SOCK_ASYNC_NOSPACE, &sk->socket->flags);
+
+	if (net_ratelimit())
+		printk(KERN_INFO "TCP: waiting for memory\n");
 
 	add_wait_queue(sk->sleep, &wait);
 	for (;;) {
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux