Netdev List
 help / color / mirror / Atom feed
* [PATCH v3] net/sched: sch_cake: skip redundant cake_mq rate updates
@ 2026-11-09 19:56 Shubhang Kaushik (Ampere)
  2026-11-12  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Shubhang Kaushik (Ampere) @ 2026-11-09 19:56 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, Jamal Hadi Salim, Jiri Pirko,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Jonas Köppeler, Shubhang Kaushik,
	Christoph Lameter (Ampere)
  Cc: Toke Høiland-Jørgensen, cake, netdev, linux-kernel,
	Shubhang Kaushik (Ampere)

cake_mq periodically counts active child qdiscs in cake_dequeue() and
derives an effective per-child shaper rate. cake_dequeue() currently
reconfigures every tin after each scan, even when that effective rate
is unchanged.

The dequeue-time call chain is:

  cake_dequeue()
    -> cake_configure_rates(..., true)
      -> cake_config_*()
        -> cake_set_rate()

With rate_adjust=true, cake_set_rate() only refreshes rate-derived
state. Tin 0 records the unscaled rate argument in every supported
CAKE tin mode, so its installed rate identifies whether this call chain
would change any state.

Skip the reconfiguration when the effective rate is already installed,
while continuing to update the activity-sampling timestamp and
active-queue statistic.

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Shubhang Kaushik (Ampere) <sh@gentwo.org>
---
Tested on an 80-core SMP, non-SMT Ampere Altra system:-

The test used a 32-TX-queue veth pair, with cake_mq bandwidth 2gbit
on the transmit side and the peer in a network namespace. The workload
was:

  iperf3 -c 198.18.0.2 -P 32 -t 30

Against mainline commit a32e63a613aa80, the patched kernel reduced
cake_configure_rates() calls by 99.99% (2,477,627 to 206) and aggregate
helper time by 99.986% (3.477 s to 0.498 ms), while retaining
approximately 1.91 Gbit/s aggregate throughput (baseline:
1.91-1.92 Gbit/s). A separate per-child trace observed no
same-effective-rate calls on the patched kernel (@unchanged: 0).
Changing cake_mq bandwidth from 2Gbit to 1Gbit and back invoked
cake_configure_rates() 64 times, matching all 32 child CAKE qdiscs
updated for each of the two control-plane changes.

Changes in v3:
- Rebased onto current net-next
- Drop the Fixes tag, as this is an optimization rather than a
  regression fix.
- Add Toke Høiland-Jørgensen's Acked-by tag.

Link to v2:
https://lore.kernel.org/r/20261026-net_sched_sch_cake-v2-1-cb1d4e6ed990@gentwo.org
---
 net/sched/sch_cake.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index aa4043d662c1cc18858d3f9c80f9d9b281f26f72..3faccdbc03f765164e9695a42e4658467183294b 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -2052,7 +2052,8 @@ static struct sk_buff *cake_dequeue(struct Qdisc *sch)
 		if (num_active_qs > 1)
 			new_rate = div64_u64(new_rate, num_active_qs);
 
-		cake_configure_rates(sch, new_rate, true);
+		if (new_rate != q->tins[0].tin_rate_bps)
+			cake_configure_rates(sch, new_rate, true);
 		q->last_checked_active = now;
 		WRITE_ONCE(q->active_queues, num_active_qs);
 	}

---
base-commit: fa5196392691051963726787944db872420dfa75
change-id: 20261109-cake-sch-cake-v3-fe73a0bb892c

Best regards,
-- 
Shubhang Kaushik (Ampere) <sh@gentwo.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-12  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 19:56 [PATCH v3] net/sched: sch_cake: skip redundant cake_mq rate updates Shubhang Kaushik (Ampere)
2026-11-12  2:00 ` patchwork-bot+netdevbpf

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