From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; dkim=pass header.d=gentwo.org header.i=@gentwo.org header.a=rsa-sha256 header.s=default header.b=WVRp1t9x; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=gentwo.org policy.dmarc=reject Received: from gentwo.org (gentwo.org [62.72.0.81]) by mail.toke.dk (Postfix) with ESMTPS id E5990190E595 for ; Sun, 25 Oct 2026 21:47:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gentwo.org; s=default; t=1792960736; bh=vhDR9J/1JpeYTHTbWM1VhL+Zm3goy3X52PJv5ZSpPPk=; h=From:Date:Subject:To:Cc:From; b=WVRp1t9xRrndhvdlCSAImgkd0S/E4HCeU2OaxLp/w1gkyzF1Nh+GIXSGOawevAncy HnqG2jJ2k9oD41SdU9OBERegr/YaKDkOlRZUHdTKyXhXgqY+tvf7cBm7wRDdIzJ28N vsowPBBcTEw+SaDLGUONMeVAouslVZaDAjfZeSmo= Received: from sut02sys-r112.scc-lab.amperecomputing.com (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTPS id DB13B4046E; Sun, 25 Oct 2026 13:38:55 -0700 (PDT) From: "Shubhang Kaushik (Ampere)" Date: Sun, 25 Oct 2026 13:38:50 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261025-net_sched_sch_cake-v1-1-5165c924a590@gentwo.org> X-B4-Tracking: v=1; b=H4sIANlo3moC/x2MQQqAIBQFrxJ/nVBKQl0lIkSf9QksNCKQ7p61G ZjFTKaEyEg0VJkiLk68hyJtXZFdTVgg2BUn2UjdNrITAeec7Ar3cbZmg4DWnfJO9cppKuER4fn +p+P0PC9z1JQ+ZAAAAA== X-Change-ID: 20261025-net_sched_sch_cake-e6653fd393d6 To: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , =?utf-8?q?Jonas_K=C3=B6ppeler?= , Shubhang Kaushik , "Christoph Lameter (Ampere)" Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , cake@lists.bufferbloat.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Shubhang Kaushik (Ampere)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792960735; l=2650; i=sh@gentwo.org; s=20251010; h=from:subject:message-id; bh=vhDR9J/1JpeYTHTbWM1VhL+Zm3goy3X52PJv5ZSpPPk=; b=uGvwwimQkYJhYoblrQwkCkNTuJKn/PRjkmo/ldLdraUPoHaoz7KLu1GS2Hw/fqT3QIAlZC7Uh U0jV7P0cxmFCr8aaWcJtM9DeewaWfIQwobGo7r1HaUaUA+MK4tW+5J+ X-Developer-Key: i=sh@gentwo.org; a=ed25519; pk=jc8YIRvxPSyJaBRe5y+a4N0RXKBUEcAh8+OFhlROXPY= X-MailFrom: sh@gentwo.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: SZL5XCG7JBXYCOIUQYKDMCVJPO6V5DVB X-Message-ID-Hash: SZL5XCG7JBXYCOIUQYKDMCVJPO6V5DVB X-Mailman-Approved-At: Sun, 25 Oct 2026 22:55:31 +0100 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Cake] [PATCH] net/sched: sch_cake: skip redundant cake_mq rate updates List-Id: Cake - FQ_codel the next generation Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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. Fixes: 1bddd758bac2 ("net/sched: sch_cake: share shaper state across sub-instances of cake_mq") Signed-off-by: Shubhang Kaushik (Ampere) --- Tested on an 80-core SMP, non-SMT Ampere Altra system (aarch64) 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 Validation 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. --- 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..dd2539cb472087af9a96b74f2ac571eb8b0a8a27 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 != READ_ONCE(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: a32e63a613aa80dfdb9acc0a09efab940e96054f change-id: 20261025-net_sched_sch_cake-e6653fd393d6 Best regards, -- Shubhang Kaushik (Ampere)