[Devel] [PATCH RHEL9 COMMIT] tcp: add drop reason support to tcp_prune_ofo_queue()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jan 16 20:56:53 MSK 2023


The commit is pushed to "branch-rh9-5.14.0-162.6.1.vz9.18.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-162.6.1.vz9.18.2
------>
commit 0b1b8544bbf15690c7e9b7004fdca9a8b95c05cc
Author: Eric Dumazet <edumazet at google.com>
Date:   Tue Jan 3 17:39:39 2023 +0200

    tcp: add drop reason support to tcp_prune_ofo_queue()
    
    Add one reason for packets dropped from OFO queue because
    of memory pressure.
    
    Signed-off-by: Eric Dumazet <edumazet at google.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>
    Acked-by: Nikolay Borisov <nborisov at suse.com>
    Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
    
    ======
    Patchset description:
    ms/net: Annotate skb free sites with reason
    
    This series backports most of the patches that add a reason to skb free sites.
    
    https://jira.sw.ru/browse/PSBM-143302
    
    Feature: net: improve verbosity of dropped packets reporting
---
 include/linux/skbuff.h     | 1 +
 include/trace/events/skb.h | 2 ++
 net/ipv4/tcp_input.c       | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4033019e93d1..c9947956680f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -390,6 +390,7 @@ enum skb_drop_reason {
 	SKB_DROP_REASON_TCP_OLD_ACK,    /* TCP ACK is old, but in window */
 	SKB_DROP_REASON_TCP_TOO_OLD_ACK, /* TCP ACK is too old */
 	SKB_DROP_REASON_TCP_ACK_UNSENT_DATA, /* TCP ACK for data we haven't sent yet */
+	SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE, /* pruned from TCP OFO queue */
 	SKB_DROP_REASON_IP_OUTNOROUTES, /* route lookup failed */
 	SKB_DROP_REASON_BPF_CGROUP_EGRESS,      /* dropped by
 						 * BPF_PROG_TYPE_CGROUP_SKB
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 4f3776c7dfcf..00b8ec2593fa 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -48,6 +48,8 @@
 	EM(SKB_DROP_REASON_TCP_TOO_OLD_ACK, TCP_TOO_OLD_ACK)    \
 	EM(SKB_DROP_REASON_TCP_ACK_UNSENT_DATA,                 \
 	   TCP_ACK_UNSENT_DATA)                                 \
+	EM(SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE,                 \
+	   TCP_OFO_QUEUE_PRUNE)					\
 	EM(SKB_DROP_REASON_IP_OUTNOROUTES, IP_OUTNOROUTES)      \
 	EM(SKB_DROP_REASON_BPF_CGROUP_EGRESS,                   \
 	   BPF_CGROUP_EGRESS)                                   \
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7c46a90bd7af..a2cbc6427dfa 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5296,7 +5296,8 @@ static bool tcp_prune_ofo_queue(struct sock *sk)
 		prev = rb_prev(node);
 		rb_erase(node, &tp->out_of_order_queue);
 		goal -= rb_to_skb(node)->truesize;
-		tcp_drop(sk, rb_to_skb(node));
+		tcp_drop_reason(sk, rb_to_skb(node),
+				SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE);
 		if (!prev || goal <= 0) {
 			sk_mem_reclaim(sk);
 			if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&


More information about the Devel mailing list