* [PATCH] net/sched: drr: reseed active class deficit after quantum changes
@ 2026-06-09 0:36 Samuel Moelius
2026-06-10 1:56 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Samuel Moelius @ 2026-06-09 0:36 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: Samuel Moelius, Jiri Pirko, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, open list:TC subsystem,
open list
Changing the quantum of an active DRR class leaves the old deficit in
place. The next scheduling round can therefore use credit accumulated
under a different quantum.
This can be observed by making a class active, changing its quantum, and
then dequeuing with the old deficit still present.
When an active class quantum changes, reseed its deficit from the new
quantum so the changed class weight is reflected immediately.
Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
---
net/sched/sch_drr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index 01335a49e091..b40df8725ba6 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -98,8 +98,11 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
}
sch_tree_lock(sch);
- if (tb[TCA_DRR_QUANTUM])
+ if (tb[TCA_DRR_QUANTUM]) {
cl->quantum = quantum;
+ if (cl_is_active(cl))
+ cl->deficit = quantum;
+ }
sch_tree_unlock(sch);
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] net/sched: drr: reseed active class deficit after quantum changes
2026-06-09 0:36 [PATCH] net/sched: drr: reseed active class deficit after quantum changes Samuel Moelius
@ 2026-06-10 1:56 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-06-10 1:56 UTC (permalink / raw)
To: Samuel Moelius
Cc: Jamal Hadi Salim, Jiri Pirko, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, open list:TC subsystem, open list
On Tue, 9 Jun 2026 00:36:18 +0000 Samuel Moelius wrote:
> Subject: [PATCH] net/sched: drr: reseed active class deficit after quantum changes
If the change is not for a serious bug it needs to be generated against
net-next. This was generated against Linus's tree I guess and doesn't
apply to -next.
> Changing the quantum of an active DRR class leaves the old deficit in
> place. The next scheduling round can therefore use credit accumulated
> under a different quantum.
>
> This can be observed by making a class active, changing its quantum, and
> then dequeuing with the old deficit still present.
>
> When an active class quantum changes, reseed its deficit from the new
> quantum so the changed class weight is reflected immediately.
TBH the current implementation is how I would expect DRR to work.
quantum is the "refill" value, it should not reset the state of
the current round? It wouldn't in an ASIC.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-10 1:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 0:36 [PATCH] net/sched: drr: reseed active class deficit after quantum changes Samuel Moelius
2026-06-10 1:56 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox