]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sctp: add enabled check for path tracepoint loop.
authorKevin Kou <qdkevin.kou@gmail.com>
Fri, 27 Dec 2019 13:11:16 +0000 (13:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Dec 2019 04:33:05 +0000 (20:33 -0800)
sctp_outq_sack is the main function handles SACK, it is called very
frequently. As the commit "move trace_sctp_probe_path into sctp_outq_sack"
added below code to this function, sctp tracepoint is disabled most of time,
but the loop of transport list will be always called even though the
tracepoint is disabled, this is unnecessary.

+ /* SCTP path tracepoint for congestion control debugging. */
+ list_for_each_entry(transport, transport_list, transports) {
+ trace_sctp_probe_path(transport, asoc);
+ }

This patch is to add tracepoint enabled check at outside of the loop of
transport list, and avoid traversing the loop when trace is disabled,
it is a small optimization.

Signed-off-by: Kevin Kou <qdkevin.kou@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/outqueue.c

index 6b0b3bad4daa669b6382a27390223a98375977f7..577e3bc4ee6f1691cfa93733fbecec23baf4c78e 100644 (file)
@@ -1240,8 +1240,9 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
        transport_list = &asoc->peer.transport_addr_list;
 
        /* SCTP path tracepoint for congestion control debugging. */
-       list_for_each_entry(transport, transport_list, transports) {
-               trace_sctp_probe_path(transport, asoc);
+       if (trace_sctp_probe_path_enabled()) {
+               list_for_each_entry(transport, transport_list, transports)
+                       trace_sctp_probe_path(transport, asoc);
        }
 
        sack_ctsn = ntohl(sack->cum_tsn_ack);