Re: bug in 2.1.89 include/net/sock.h?

David S. Miller (davem@dm.cobaltmicro.com)
Sun, 22 Mar 1998 15:02:25 -0800


Date: Sun, 22 Mar 1998 14:55:07 -0800 (PST)
From: Linus Torvalds <torvalds@transmeta.com>

If ACK's etc frames take up resources, we _have_ to wake up,
because otherwise we can have cases where we never wake up when the
resources are free'd.

I determined that this was an impossible event, at least for TCP, but
for other reasons I agree that my suggested approach is a bad one.

Something like

/* Wake up only if we have more than half the wspace free: */
if (atomic_read(sk->wmem_alloc)*2 <= sk->sndbuf)) {
... wake_up() ..
}

should get rid of some unnecessary wake-ups, whether they are due
to ACK's or not. There's no point in having the writer trickle the
write data in small chunks anyway.

Sounds good. As Alexey mentioned, this was exactly what the code used
to do a long time ago, but the conditional disappeared early in the
2.1.x series.

Outside of the ACK cases, the other bogus case as I mentioned is for
clones of real outgoing data packets, used for transmission, the SOCK
gets charged again for the entire data area when in reality only
sizeof(struct sk_buff) more memory is being tied up due to the clone.

So the behavior observed is that if (for example) the outgoing
interface takes a little bit of time to transmit and free up the clone
it gets passed, a bulk call to tcp_do_sendmsg() will effectively only
allow the process to use half of sk->sndbuf for it's data if not less,
and this is because of the clone SKB issue I just mentioned.

Later,
David S. Miller
davem@dm.cobaltmicro.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu