Netdev List
 help / color / mirror / Atom feed
From: willemb@google.com
To: netdev-bot+sashiko@kernel.org, edumazet@kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	 willemb@google.com, horms@kernel.org, netdev@vger.kernel.org,
	 jhs@mojatatu.com
Subject: Re: [PATCH net] net/sched: fq_pie: clear memory_usage and flow backlog in fq_pie_reset()
Date: Mon, 30 Nov 2026 10:15:01 -0500	[thread overview]
Message-ID: <willemb.4900d4289b26@google.com> (raw)
In-Reply-To: <179554612514.3135.4817357528010046097@kernel.org>

netdev-bot+sashiko@ wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.

> Critical: 0 · High: 1 · Medium: 0 · Low: 0

> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).

> - [High] This patch leaves the problem it gives as its reason for
>    clearing `flow->backlog` in place for the default configuration.

> --

> net/sched: fq_pie: clear memory_usage and flow backlog in fq_pie_reset()

> This commit makes fq_pie_reset() clear q->memory_usage, matching
> fq_codel_reset(), so tc statistics and the overmemory counter stay correct
> after a non-empty qdisc is reset. It also clears flow->backlog, since
> fq_pie_timer() keeps passing it to pie_calculate_probability() for flows
> that no longer hold packets.

> > diff --git a/net/sched/sch_fq_pie.c b/net/sched/sch_fq_pie.c
> > index 5982847df8f85..a5e2a83efb679 100644
> > --- a/net/sched/sch_fq_pie.c
> > +++ b/net/sched/sch_fq_pie.c
> > @@ -547,10 +547,12 @@ static void fq_pie_reset(struct Qdisc *sch)
> >  		/* Removes all packets from flow */
> >  		rtnl_kfree_skbs(flow->head, flow->tail);
> >  		flow->head = NULL;
> > +		flow->backlog = 0;
> >
> >  		INIT_LIST_HEAD(&flow->flowchain);
> >  		pie_vars_init(&flow->vars);

> [Severity: High]
> Is clearing flow->backlog enough to stop fq_pie_timer() from feeding stale
> per-flow state into pie_calculate_probability()?

> With the default dq_rate_estimator=0, pie_calculate_probability() does not
> derive the delay from the backlog argument. It reads the cached values:

> net/sched/sch_pie.c:pie_calculate_probability() {
>      ...
> 	} else {
> 		qdelay = vars->qdelay;
> 		qdelay_old = vars->qdelay_old;
> 	}
>      ...
> 	delta += alpha * (qdelay - params->target);
> 	delta += beta * (qdelay - qdelay_old);
>      ...
> }

> In that mode backlog only gates update_prob when qdelay is 0.

> pie_vars_init() only resets burst_time, dq_tstamp, accu_prob, dq_count and
> avg_dq_rate. It leaves vars->qdelay, vars->qdelay_old, vars->prob and
> vars->backlog_old as they were.

> When the dequeue-time estimator is off, pie_process_dequeue() is the only
> place that writes a fresh vars->qdelay. The reset frees the packets  
> without
> going through it. If the flow was congested at reset time, vars->qdelay
> therefore keeps the last sojourn time of the purged queue.

> adapt_timer is only stopped in fq_pie_destroy(), so it keeps running after
> a reset such as:

> linkwatch -> dev_deactivate() -> dev_deactivate_many() ->  
> dev_reset_queue()
>    -> qdisc_reset() -> fq_pie_reset()

> If the stale qdelay is above target, can each tupdate round compute a
> positive delta and keep raising prob for as long as the flow is idle? The
> decay branch for qdelay == 0 && qdelay_old == 0 never runs in that case.
> prob is only clamped when the u64 wraps, so it looks like it can grow past
> MAX_PROB.

> When traffic hashed to that bucket comes back, the 150ms burst_time runs
> out. After that, pie_drop_early() no longer takes this early return:

> 	if ((vars->qdelay < params->target / 2) &&
> 	    (vars->prob < MAX_PROB / 5))
> 		return false;

> Would that flow then see almost every packet dropped once its backlog
> reaches 2 MTU? It looks like this would last until prob decays, which can
> take seconds or longer depending on how long the flow was idle.

> Should the reset path also clear vars->qdelay, vars->qdelay_old,  
> vars->prob
> and vars->backlog_old? That could go either in fq_pie_reset() or in a
> full-reset helper. pie_reset() in sch_pie.c appears to have the same gap.

PTAL at this.

Looks like it can go in a separate follow-up.

Applying this fix as is.

      reply	other threads:[~2026-11-30 15:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 18:46 [PATCH net] net/sched: fq_pie: clear memory_usage and flow backlog in fq_pie_reset() Eric Dumazet
2026-11-24  0:49 ` Jamal Hadi Salim
2026-11-24 18:48 ` netdev-bot+sashiko
2026-11-30 15:15   ` willemb [this message]

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=willemb.4900d4289b26@google.com \
    --to=willemb@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox