From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; dkim=none; arc=none (Message is not ARC signed); dmarc=fail (Used From Domain Record) header.from=toke.dk policy.dmarc=none Date: Tue, 21 Jul 2026 08:55:23 +0200 From: =?ISO-8859-1?Q?Toke_H=F8iland-J=F8rgensen?= To: =?ISO-8859-1?Q?Jonas_K=F6ppeler?= , Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman CC: cake@lists.bufferbloat.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Pham In-Reply-To: <20260720-sch_cake-skip-clearing-tins-v2-1-e6a8b0275c73@tu-berlin.de> References: <20260720-sch_cake-skip-clearing-tins-v2-1-e6a8b0275c73@tu-berlin.de> X-Clacks-Overhead: GNU Terry Pratchett Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NQFITKYQC2F7FRVKUACZ5ZUFZRUCYNP6 X-Message-ID-Hash: NQFITKYQC2F7FRVKUACZ5ZUFZRUCYNP6 X-MailFrom: toke@toke.dk X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Subject: [Cake] Re: [PATCH net-next v2] net/sched: sch_cake: skip clearing unused tins during rate adjustment List-Id: Cake - FQ_codel the next generation Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 20 July 2026 23=2E14=2E52 CEST, "Jonas K=C3=B6ppeler" wrote: >When cake_configure_rates() is called from the dequeue path with >rate_adjust=3Dtrue, it only needs to update the rate parameters=2E The >loop that clears the unused tins is both unnecessary and harmful in >this path: > > - cake_clear_tin() overwrites q->cur_tin and q->cur_flow, which are > actively used by cake_dequeue(), corrupting the dequeue state=2E > - iterating over the unused tins and their internal queues to purge > packets adds needless overhead to the hot path=2E > >Skip the entire loop when rate_adjust is set, as neither >cake_clear_tin() nor the mtu_time update are needed when only the >rate changes=2E > >The clearing loop runs on every rate adjustment from the dequeue path, >clearing (max_tins - cur_tins) tins each time, so the cost grows the >fewer tins the configured mode actually uses=2E Testing cake_mq over veth >(8 rx/tx queues, 2 Gbit limit) with flent's [1] rrul and tcp_nup tests an= d >32 TCP upstreams shows a large drop in loaded latency and a throughput >gain, restoring behaviour to pre-15c2715a5264 levels: > > +------------+------+------+-------+-------+---------+ > | kernel | mode | test | base | load | tput | > | | | | (ms) | (ms) | (Mbit) | > +------------+------+------+-------+-------+---------+ > | net-next | be | rrul | 0=2E810 | 11=2E78 | 1469=2E67 | > | net-next | be | nup | 0=2E637 | 85=2E71 | 1243=2E15 | > | net-next | ds3 | rrul | 0=2E397 | 15=2E28 | 1770=2E06 | > | net-next | ds3 | nup | 0=2E351 | 15=2E98 | 1799=2E39 | > +------------+------+------+-------+-------+---------+ > | patched | be | rrul | 0=2E092 | 0=2E56 | 1873=2E40 | > | patched | be | nup | 0=2E109 | 1=2E82 | 1869=2E12 | > | patched | ds3 | rrul | 0=2E097 | 0=2E98 | 1866=2E10 | > | patched | ds3 | nup | 0=2E101 | 0=2E51 | 1861=2E79 | > +------------+------+------+-------+-------+---------+ > >The same trend holds on real hardware (IPQ8074A, 4 rx/tx queues, >OpenWrt): in besteffort mode the tcp_nup loaded latency drops from >~470 ms to ~4 ms=2E > >[1] https://flent=2Eorg > >Fixes: 15c2715a5264 ("net/sched: sch_cake: fixup cake_mq rate adjustment = for diffserv config") >Signed-off-by: Jonas K=C3=B6ppeler >Tested-by: Mike Pham Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen