Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net/sched: fq_pie: clear memory_usage and flow backlog in fq_pie_reset()
@ 2026-11-23 18:46 Eric Dumazet
  0 siblings, 0 replies; only message in thread
From: Eric Dumazet @ 2026-11-23 18:46 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Willem de Bruijn
  Cc: Simon Horman, netdev, edumazet, Jamal Hadi Salim

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23 18:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 18:46 [PATCH net] net/sched: fq_pie: clear memory_usage and flow backlog in fq_pie_reset() Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox