diff mbox series

net: sched: fix ordering of qlen adjustment

Message ID 6c7ae1c8-8573-4f4a-96cb-0a75eab21516@gmail.com (mailing list archive)
State Accepted
Commit 5eb7de8cd58e73851cd37ff8d0666517d9926948
Delegated to: Netdev Maintainers
Headers show
Series net: sched: fix ordering of qlen adjustment | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: cake@lists.bufferbloat.net horms@kernel.org
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 304 this patch: 304
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-02--21-00 (tests: 760)

Commit Message

Lion Ackermann Dec. 2, 2024, 4:22 p.m. UTC
Changes to sch->q.qlen around qdisc_tree_reduce_backlog() need to happen
_before_ a call to said function because otherwise it may fail to notify
parent qdiscs when the child is about to become empty.

Signed-off-by: Lion Ackermann <nnamrec@gmail.com>
---
 net/sched/sch_cake.c  | 2 +-
 net/sched/sch_choke.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Toke Høiland-Jørgensen Dec. 3, 2024, 8:48 a.m. UTC | #1
Lion Ackermann <nnamrec@gmail.com> writes:

> Changes to sch->q.qlen around qdisc_tree_reduce_backlog() need to happen
> _before_ a call to said function because otherwise it may fail to notify
> parent qdiscs when the child is about to become empty.
>
> Signed-off-by: Lion Ackermann <nnamrec@gmail.com>

For sch_cake:

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
patchwork-bot+netdevbpf@kernel.org Dec. 4, 2024, 1 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 2 Dec 2024 17:22:57 +0100 you wrote:
> Changes to sch->q.qlen around qdisc_tree_reduce_backlog() need to happen
> _before_ a call to said function because otherwise it may fail to notify
> parent qdiscs when the child is about to become empty.
> 
> Signed-off-by: Lion Ackermann <nnamrec@gmail.com>
> ---
>  net/sched/sch_cake.c  | 2 +-
>  net/sched/sch_choke.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
  - net: sched: fix ordering of qlen adjustment
    https://git.kernel.org/netdev/net/c/5eb7de8cd58e

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index 30955dd45779..a65fad45d556 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -1542,7 +1542,6 @@  static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
 	b->backlogs[idx]    -= len;
 	b->tin_backlog      -= len;
 	sch->qstats.backlog -= len;
-	qdisc_tree_reduce_backlog(sch, 1, len);
 
 	flow->dropped++;
 	b->tin_dropped++;
@@ -1553,6 +1552,7 @@  static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
 
 	__qdisc_drop(skb, to_free);
 	sch->q.qlen--;
+	qdisc_tree_reduce_backlog(sch, 1, len);
 
 	cake_heapify(q, 0);
 
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index 19c851125901..a91959142208 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -123,10 +123,10 @@  static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx,
 	if (idx == q->tail)
 		choke_zap_tail_holes(q);
 
+	--sch->q.qlen;
 	qdisc_qstats_backlog_dec(sch, skb);
 	qdisc_tree_reduce_backlog(sch, 1, qdisc_pkt_len(skb));
 	qdisc_drop(skb, sch, to_free);
-	--sch->q.qlen;
 }
 
 struct choke_skb_cb {