Skip to content

Commit a76c0ad

Browse files
Thomas Grafdavem330
authored andcommitted
sctp: Do not account for sizeof(struct sk_buff) in estimated rwnd
When checking whether a DATA chunk fits into the estimated rwnd a full sizeof(struct sk_buff) is added to the needed chunk size. This quickly exhausts the available rwnd space and leads to packets being sent which are much below the PMTU limit. This can lead to much worse performance. The reason for this behaviour was to avoid putting too much memory pressure on the receiver. The concept is not completely irational because a Linux receiver does in fact clone an skb for each DATA chunk delivered. However, Linux also reserves half the available socket buffer space for data structures therefore usage of it is already accounted for. When proposing to change this the last time it was noted that this behaviour was introduced to solve a performance issue caused by rwnd overusage in combination with small DATA chunks. Trying to reproduce this I found that with the sk_buff overhead removed, the performance would improve significantly unless socket buffer limits are increased. The following numbers have been gathered using a patched iperf supporting SCTP over a live 1 Gbit ethernet network. The -l option was used to limit DATA chunk sizes. The numbers listed are based on the average of 3 test runs each. Default values have been used for sk_(r|w)mem. Chunk Size Unpatched No Overhead ------------------------------------- 4 15.2 Kbit [!] 12.2 Mbit [!] 8 35.8 Kbit [!] 26.0 Mbit [!] 16 95.5 Kbit [!] 54.4 Mbit [!] 32 106.7 Mbit 102.3 Mbit 64 189.2 Mbit 188.3 Mbit 128 331.2 Mbit 334.8 Mbit 256 537.7 Mbit 536.0 Mbit 512 766.9 Mbit 766.6 Mbit 1024 810.1 Mbit 808.6 Mbit Signed-off-by: Thomas Graf <tgraf@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e8303a3 commit a76c0ad

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

‎net/sctp/output.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,13 +697,7 @@ static void sctp_packet_append_data(struct sctp_packet *packet,
697697
/* Keep track of how many bytes are in flight to the receiver. */
698698
asoc->outqueue.outstanding_bytes += datasize;
699699

700-
/* Update our view of the receiver's rwnd. Include sk_buff overhead
701-
* while updating peer.rwnd so that it reduces the chances of a
702-
* receiver running out of receive buffer space even when receive
703-
* window is still open. This can happen when a sender is sending
704-
* sending small messages.
705-
*/
706-
datasize += sizeof(struct sk_buff);
700+
/* Update our view of the receiver's rwnd. */
707701
if (datasize < rwnd)
708702
rwnd -= datasize;
709703
else

‎net/sctp/outqueue.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,7 @@ void sctp_retransmit_mark(struct sctp_outq *q,
411411
chunk->transport->flight_size -=
412412
sctp_data_size(chunk);
413413
q->outstanding_bytes -= sctp_data_size(chunk);
414-
q->asoc->peer.rwnd += (sctp_data_size(chunk) +
415-
sizeof(struct sk_buff));
414+
q->asoc->peer.rwnd += sctp_data_size(chunk);
416415
}
417416
continue;
418417
}
@@ -432,8 +431,7 @@ void sctp_retransmit_mark(struct sctp_outq *q,
432431
* (Section 7.2.4)), add the data size of those
433432
* chunks to the rwnd.
434433
*/
435-
q->asoc->peer.rwnd += (sctp_data_size(chunk) +
436-
sizeof(struct sk_buff));
434+
q->asoc->peer.rwnd += sctp_data_size(chunk);
437435
q->outstanding_bytes -= sctp_data_size(chunk);
438436
if (chunk->transport)
439437
transport->flight_size -= sctp_data_size(chunk);

0 commit comments

Comments
 (0)