]> err.no Git - linux-2.6/commitdiff
[DCCP] ACKVEC: Optimization - Do not traverse records if none will be found
authorAndrea Bittau <a.bittau@cs.ucl.ac.uk>
Tue, 14 Nov 2006 15:19:45 +0000 (13:19 -0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:22:31 +0000 (21:22 -0800)
Do not traverse the list of ack vector records [proportional to window size]
when we know we will not find what we are looking for.  This is especially
useful because ack vectors are checked twice:
1) Upon parsing of options.
2) Upon notification of a new ack.

All of the work will occur during check #1.  Therefore, when check #2 is
performed, no new work will be done.  This is now "detected" and there is no
performance hit when doing #2.

Signed-off-by: Andrea Bittau <a.bittau@cs.ucl.ac.uk>
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/dccp/ackvec.c

index 0c54b89a4e9b3cc50e1219a057a92e827480cfc7..bd20a2c55e25e0ab797876e6f5afac01b36a0785 100644 (file)
@@ -383,7 +383,8 @@ void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av, struct sock *sk,
                                      (unsigned long long)avr->dccpavr_ack_ackno);
                        dccp_ackvec_throw_record(av, avr);
                        break;
-               }
+               } else if (avr->dccpavr_ack_seqno > ackno)
+                       break; /* old news */
        }
 }