All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@kernel.org>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>
Cc: Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, edumazet@kernel.org,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: [PATCH net] net/sched: fq_pie: clear memory_usage and flow backlog in fq_pie_reset()
Date: Mon, 23 Nov 2026 19:46:02 +0100	[thread overview]
Message-ID: <20261123184602.386372-1-edumazet@kernel.org> (raw)

fq_pie_reset() frees all queued packets but does not update
q->memory_usage, which is only decremented in fq_pie_qdisc_dequeue().

After each reset of a non-empty qdisc (dev_deactivate(), parent purge),
the memory_usage reported in tc statistics is too high, and once it
exceeds memory_limit the overmemory counter is incremented for every
enqueued packet.

Clear q->memory_usage like fq_codel_reset() does.

Also clear flow->backlog, as fq_pie_timer() keeps feeding it to
pie_calculate_probability() for flows that no longer hold packets.

Found by code inspection (AI review) while looking at an unrelated
syzbot KCSAN report in fq_pie_reset(), not reproduced.

Fixes: ec97ecf1ebe4 ("net: sched: add Flow Queue PIE packet scheduler")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
 net/sched/sch_fq_pie.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sched/sch_fq_pie.c b/net/sched/sch_fq_pie.c
index 5982847df8f8..a5e2a83efb67 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);
 	}
+	q->memory_usage = 0;
 }
 
 static void fq_pie_destroy(struct Qdisc *sch)
-- 
2.53.0


             reply	other threads:[~2026-11-23 18:46 UTC|newest]

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

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=20261123184602.386372-1-edumazet@kernel.org \
    --to=edumazet@kernel.org \
    --cc=davem@davemloft.net \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.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.