Conversation
0808c46 to
3043f90
Compare
I think r/w access to the packet is required for various congestion control related implementation. For example CUBIC (#475) need |
3043f90 to
ecdde0f
Compare
The new It also seems to me that Linux works the same way as this PR, that is, it first processes SACKs in a loop, and then calls Though, in the worst case scenario, each callback can still loop through the
Why would it need to update information of acked packets? Like, it seems pointless to modify the But in any case I think the point from before applies, Linux seems to follow the same process as what is implemented in this PR, so if they can implement BBR like that why can't we? |
|
I think now I understand what you try to do. First of all I don't think we want to follow what linux tcp does - different OS has different tcp implementation. However while I agree we may not need to access I will add a comment in the code instead.
In linux tcp, it pass the number of packet acked by the ack additionally. Hystart++ need the same information but it's ok for now because current master iterates over acked packet so we can get acked packet count from there. |
0b7493c to
ff6719e
Compare
0415612 to
1135e74
Compare
48e7409 to
f2049a6
Compare
Instead of using a BTreeMap, use a VecDeque to track sent packets, which makes it easier to keep track of acked and lost packets for a short time after they have been acked or declared lost instead of immediately removing them from the list, which in turn will allow detecting things like DSACKs and spurious losses. Similarly to how the BTreeMap was used, sent packets are appended to the back of the queue (so they end up being sorted by packet number / sent time). Access now happen by iterating over the queue from the start rather than looking up specific packets by packet number. When acked or declared lost, the packets are simply marked accordingly _without_ being removed from the queue. At predefined times, the semt packets marked as acked or lost are then removed from the start of the queue in contiguous blocks, in order to avoid having to copy elements around to cover gaps in the queue caused by removed elements. Later this can be changed to e.g. delay cleaning of lost packets for 1 RTT after they were marked as lost. This new strcture also allows us to follow the -recovery draft pseudo-code somewhat more closely, and as a side-effect, there are no more potentially expensive BTreeMap lookups in hot codepaths, which might help reduce CPU usage when e.g. processing ACK frames (flamegraphs generated on my laptop show that the time spent inside Recovery::on_ack_received() is cut in half).
f2049a6 to
c1bd7eb
Compare
Instead of using a BTreeMap, use a VecDeque to track sent packets, which
makes it easier to keep track of acked and lost packets for a short time
after they have been acked or declared lost instead of immediately
removing them from the list, which in turn will allow detecting things
like DSACKs and spurious losses.
Similarly to how the BTreeMap was used, sent packets are appended to the
back of the queue (so they end up being sorted by packet number / sent
time). Access now happen by iterating over the queue from the start
rather than looking up specific packets by packet number. When acked or
declared lost, the packets are simply marked accordingly without being
removed from the queue.
At predefined times, the semt packets marked as acked or lost are then
removed from the start of the queue in contiguous blocks, in order to
avoid having to copy elements around to cover gaps in the queue caused
by removed elements. Later this can be changed to e.g. delay cleaning of
lost packets for 1 RTT after they were marked as lost.
This new strcture also allows us to follow the -recovery draft
pseudo-code somewhat more closely, and as a side-effect, there are no
more potentially expensive BTreeMap lookups in hot codepaths, which
might help reduce CPU usage when e.g. processing ACK frames (flamegraphs
generated on my laptop show that the time spent inside
Recovery::on_ack_received() is cut in half).
This is based on #468. Note that before merging we should do more testing in the lab to make sure this doesn't have any adverse side-effects.