From: Jakub Kicinski <kuba@kernel.org>
To: William Liu <will@willsroot.io>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, pabeni@redhat.com, jiri@resnulli.us,
davem@davemloft.net, edumazet@google.com, horms@kernel.org,
savy@syst3mfailure.io, victor@mojatatu.com
Subject: Re: [PATCH net v4 1/2] net/sched: Fix backlog accounting in qdisc_dequeue_internal
Date: Mon, 11 Aug 2025 10:24:49 -0700 [thread overview]
Message-ID: <20250811102449.50e5f416@kernel.org> (raw)
In-Reply-To: <-8f3jdd-5pxHr0GW-uu8VtTzqDKDOyJohJ-soIwzRyqJUub186VYIxqNoGOTh8Oxtu1U0CEDl5h3N1c1D1jbn7nIlXUrNo55CHK5KcT23c4=@willsroot.io>
On Mon, 11 Aug 2025 16:52:51 +0000 William Liu wrote:
> > > Can you elaborate on this?
> > >
> > > I just moved the reset of two cstats fields from the dequeue handler
> > > epilogue to the prologue. Those specific cstats fields are not used
> > > elsewhere so they should be fine,
> >
> >
> > That's the disconnect. AFAICT they are passed to codel_dequeue(),
> > and will be used during normal dequeue, as part of normal active
> > queue management under traffic..
> >
>
> Yes, that is the only place those values are used. From my
> understanding, codel_dequeue is only called in fq_codel_dequeue. So
> moving the reset from the dequeue epilogue to the dequeue prologue
> should be fine as the same behavior is kept - the same values should
> always be used by codel_dequeue.
>
> Is there a case I am not seeing? If so, I can just add additional
> fields to the fq_codel_sched_data, but wanted to avoid doing that for
> this one edge case.
This sort of separation of logic is very error prone in general.
If you're asking for a specific bug that would exist with your
patch - I believe that two subsequent fq_codel_change() calls,
first one reducing the limit, the other one _not_ reducing (and
therefore never invoking dequeue) will adjust the backlog twice.
As I commented in the previous message - wouldn't counting the
packets we actually dequeue not solve this problem? smth like:
pkts = 0;
bytes = 0;
while (sch->q.qlen > sch->limit ||
q->memory_usage > q->memory_limit) {
struct sk_buff *skb = qdisc_dequeue_internal(sch, false);
pkts++;
bytes += qdisc_pkt_len(skb);
rtnl_kfree_skbs(skb, skb);
}
qdisc_tree_reduce_backlog(sch, pkts, bytes);
? "Conceptually" we are only responsible for adjusting the backlog
for skbs we actually gave to kfree_skb().
next prev parent reply other threads:[~2025-08-11 17:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-27 23:56 [PATCH net v4 1/2] net/sched: Fix backlog accounting in qdisc_dequeue_internal William Liu
2025-07-27 23:57 ` [PATCH net v4 2/2] selftests/tc-testing: Check backlog stats in gso_skb case William Liu
2025-07-30 17:54 ` Cong Wang
2025-07-30 17:59 ` William Liu
2025-08-08 21:27 ` [PATCH net v4 1/2] net/sched: Fix backlog accounting in qdisc_dequeue_internal Jakub Kicinski
2025-08-10 21:06 ` William Liu
2025-08-11 15:29 ` Jakub Kicinski
2025-08-11 16:52 ` William Liu
2025-08-11 17:24 ` Jakub Kicinski [this message]
2025-08-11 17:51 ` William Liu
2025-08-12 0:51 ` Jakub Kicinski
2025-08-12 2:10 ` William Liu
2025-08-12 14:38 ` Jakub Kicinski
2025-08-12 16:59 ` William Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250811102449.50e5f416@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=savy@syst3mfailure.io \
--cc=victor@mojatatu.com \
--cc=will@willsroot.io \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.