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 From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Jamal Hadi Salim , netdev@vger.kernel.org Cc: Jamal Hadi Salim , Jiri Pirko , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , cake@lists.bufferbloat.net, Victor Nogueira , Sashiko In-Reply-To: References: Date: Thu, 08 Oct 2026 12:19:43 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <8733ugtry8.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DGOFLYCRXK3URSONVIZOKCLFVLFSIUFG X-Message-ID-Hash: DGOFLYCRXK3URSONVIZOKCLFVLFSIUFG 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 2/4] net/sched/sch_cake: reduce parent backlog when clearing a tin List-Id: Cake - FQ_codel the next generation Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Jamal Hadi Salim writes: > CAKE has purged unused tins on DiffServ reconfiguration since commit > 83f8fd69af4f ("sch_cake: Add DiffServ handling") without propagating the > resulting backlog reduction to classful parents. The issue was noticed > while reviewing 7cbfb180945c, but predates that change. > > cake_clear_tin() drops every packet from a tin with > kfree_skb_reason() but never calls qdisc_tree_reduce_backlog(), so a > CAKE qdisc under a classful parent (e.g. HTB) leaves the dropped packets > in the parent qdisc's and class's qlen/backlog accounting forever. The > normal dequeue path does reduce the parent; only the live reconfigure > purge misses it. > > Tins are cleared from cake_reset() and, on reconfigure, from > cake_configure_rates(). The qdisc core already owns the parent delta for > the reset path: qdisc_purge_queue() snapshots qlen/backlog, runs > qdisc_reset(), then reduces the tree, so propagating the reduction from > cake_clear_tin() itself would subtract the same backlog twice. Snapshot > CAKE's qlen/backlog around only the reconfiguration purge in > cake_configure_rates() and reduce the parent once afterwards, matching > the delta pattern already used by cake_enqueue(). > > Conditions to recreate the bug: put CAKE (diffserv8) under an HTB class, > flood DSCP-classified traffic into a high tin so it backlogs, then change > CAKE to diffserv3. The HTB parent keeps the purged packets in its qlen > and backlog; a kernel with the fix shows the parent at the leaf's backlog > (426b/5p) instead of retaining the purged packets. > > Reported-by: Sashiko (gemini) > Link: https://sashiko.dev/#/patchset/20260816012109.2865223-1-ooonea@gmai= l.com > Link: https://lore.kernel.org/netdev/20260816012109.2865223-1-ooonea@gmai= l.com/ > Reviewed-by: Victor Nogueira > Signed-off-by: Jamal Hadi Salim Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen