[PATCH] net/sched: fq_pie: clamp flow deficit after quantum changes

From: Samuel Moelius

Date: Mon Jun 08 2026 - 20:46:28 EST


fq_pie keeps active flow deficits when userspace changes the scheduler
quantum. The next dequeue rounds can therefore spend credit that was
accumulated under the previous quantum.

This can be observed by making a flow active, changing the quantum, and
then dequeuing with the old deficit still present.

Clamp active flow deficits to the new quantum when the configured
quantum changes.

Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <sam.moelius@xxxxxxxxxxxxxxx>
---
net/sched/sch_fq_pie.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/net/sched/sch_fq_pie.c b/net/sched/sch_fq_pie.c
index 7becbf5362b3..9c551bdb799d 100644
--- a/net/sched/sch_fq_pie.c
+++ b/net/sched/sch_fq_pie.c
@@ -284,6 +284,19 @@ static struct sk_buff *fq_pie_qdisc_dequeue(struct Qdisc *sch)
return skb;
}

+static void fq_pie_clamp_active_deficits(struct fq_pie_sched_data *q,
+ u32 quantum)
+{
+ struct fq_pie_flow *flow;
+
+ list_for_each_entry(flow, &q->new_flows, flowchain)
+ if (READ_ONCE(flow->deficit) > quantum)
+ WRITE_ONCE(flow->deficit, quantum);
+ list_for_each_entry(flow, &q->old_flows, flowchain)
+ if (READ_ONCE(flow->deficit) > quantum)
+ WRITE_ONCE(flow->deficit, quantum);
+}
+
static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
@@ -340,8 +353,10 @@ static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,
WRITE_ONCE(q->p_params.beta,
nla_get_u32(tb[TCA_FQ_PIE_BETA]));

- if (tb[TCA_FQ_PIE_QUANTUM])
+ if (tb[TCA_FQ_PIE_QUANTUM]) {
+ fq_pie_clamp_active_deficits(q, nla_get_u32(tb[TCA_FQ_PIE_QUANTUM]));
WRITE_ONCE(q->quantum, nla_get_u32(tb[TCA_FQ_PIE_QUANTUM]));
+ }

if (tb[TCA_FQ_PIE_MEMORY_LIMIT])
WRITE_ONCE(q->memory_limit,
--
2.43.0