From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795044258; b=jLgy6sxjVL/GB20pD00hgCIiOJODvinPm/5YYMsXIqODEGr+ERCA86QyoRbPmGXpnwtT av02i5hFyRbKz+IRGvVEAHy3CRUrrl9XU7EQj0E+4ayQ6QaV0TdGm0zsgin08eBJem0Vw eRVV8scf+SoKoNEBmXS/edu0Scwd9iKUZKC0zAeYEb7W9sg7/osDUUmHmvS+rTZ3NZRCy ztQ5YBKAf528nVnaPapE35wy0t9bMQuF9ZtrGb4WGZLLXQMfNc1/xzp7YrcckwQfWb7AQ +s93yW85G/L5hz9EbNl9zi9vniWrEV0ChSK1WO2qflZHBFAMz46cOA90TtID9/cGI/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795044258; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Q9QtA7PIbf1/UiHNPt+ABfdaVVR2AGUKLt0K0i5I9Q8=; b=DnKw95Kfok/LNHjmqZIcsR/7QLGeKdFHMt/21oJrWTiNeWcqU4A2mw6f7ZAOK9pjR0ru adwVtj19OxGdhxZa0YOyUwT6tcYXM7hLDpCgPd31uCSqZUaXRBnzmwfJ+Wf3GZ6NRBjTp +lBbTu85gMpFPEiS+IcnkypRbf2YRGjDJ3kga4NcaVKgYm5AXaAg3YCw3IfU9n7gl45tp bT7lOq7VAs8i8ARX0jDWcMA0DJlwqIsbJdW/HzCKvwNHg75OUifmuACBtUMKpyD9y7tkp WL1M3dZop2StewG0nI6RzN9pArbzf9v3bFFVrpleR6H4VEyWZITEVHN6Fk3D9jpmhYA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=FHt9S3Fy; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 355B2606A31C; Wed, 18 Nov 2026 23:24:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=FHt9S3Fy Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82A6C1F000C7; Wed, 18 Nov 2026 23:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795044258; bh=Q9QtA7PIbf1/UiHNPt+ABfdaVVR2AGUKLt0K0i5I9Q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FHt9S3FyYS/n1lGv9DOxFp5oPTzAdYaVLJgnlfRNgQmvNClw+f5GL8iEkBqyg+glF KZljkNy67UbsN8KYqddMcKKZJzBupiUY2S6CY+lwLLNmob2KEaC8twvL9Zyi5HGe4j Rb9x6lXqfTgOH9NwCxH2j3AFj2JpR40w4YlB3uH0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Antonio Quartulli , Eric Dumazet , Jesper Dangaard Brouer , Jakub Kicinski Subject: [PATCH 6.1 0502/2857] net/sched: fix packet reordering on requeue Date: Wed, 18 Nov 2026 15:25:36 +0100 Message-ID: <20261118150219.529694222@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Antonio Quartulli commit 14368b9aa1017fee35d2589be7b17e0485c0f93e upstream. dev_requeue_skb() appends requeued skbs to the tail of q->gso_skb, while dequeue_skb() takes them back one at a time from the head. If the driver returns NETDEV_TX_BUSY again for the first of them, it moves behind the skbs still parked there and is sent after them. This showed up as heavy TCP reordering while benchmarking over veth, which returns NETDEV_TX_BUSY whenever its ring is full since commit dc82a33297fc ("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops"). Requeue the skbs at the head of gso_skb, keeping their order. With 4 TCP streams over a veth pair with a pfifo qdisc, this removes about 1.3M out-of-order segments and 15-37k retransmits per 15 seconds, and raises throughput from about 40 to 76 Gbit/s. Fixes: a53851e2c321 ("net: sched: explicit locking in gso_cpu fallback") Fixes: 9540d977618c ("net: sched: fix skb leak in dev_requeue_skb()") Cc: stable@vger.kernel.org Signed-off-by: Antonio Quartulli Reviewed-by: Eric Dumazet Acked-by: Jesper Dangaard Brouer Link: https://patch.msgid.link/20261026153113.3275494-1-antonio@mandelbit.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_generic.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -141,8 +141,11 @@ static inline void qdisc_enqueue_skb_bad static inline void dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) { + struct sk_buff_head requeue; spinlock_t *lock = NULL; + __skb_queue_head_init(&requeue); + if (q->flags & TCQ_F_NOLOCK) { lock = qdisc_lock(q); spin_lock(lock); @@ -151,7 +154,7 @@ static inline void dev_requeue_skb(struc while (skb) { struct sk_buff *next = skb->next; - __skb_queue_tail(&q->gso_skb, skb); + __skb_queue_tail(&requeue, skb); /* it's still part of the queue */ if (qdisc_is_percpu_stats(q)) { @@ -167,6 +170,11 @@ static inline void dev_requeue_skb(struc skb = next; } + /* the skbs may come from the head of gso_skb, so put them back there: + * appending them would let the ones still parked overtake them + */ + skb_queue_splice(&requeue, &q->gso_skb); + if (lock) { spin_unlock(lock); set_bit(__QDISC_STATE_MISSED, &q->state);