🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3536

[PATCH net-next v2 0/4] net/sched: sch_cake: fixes for accounting and reconfiguration

#3536
From: Jamal Hadi Salim
Date: Thu, 15 Oct 2026 10:32
53 lines
10287 bytes
Four independent fixes in the CAKE qdisc.  Three are follow-ups to the
autorate reconfiguration work around commit 7cbfb180945c ("net/sched:
sch_cake: fix autorate reconfiguration throttling") and the 32-bit
admission-counter wraps fixed in gred/bfifo/plug by commit 4c660ee8c809
("net: sched: fix 32-bit backlog wrap in gred, bfifo and plug enqueue");
the fourth is a dead-code cleanup found while auditing the dump path.

Patch 1 serializes a 'tc qdisc change' with the datapath's autorate
update under the qdisc lock, so the netlink writer and the autorate
writer can no longer lose the configured rate.  rate_bps needs no atomic
(it is only loaded and stored), so it stays a plain u64 with
READ_ONCE()/WRITE_ONCE() annotations.

Patch 2 propagates the backlog reduction of the reconfigure-time tin
purge to classful parents, so a CAKE leaf under HTB no longer leaves the
purged packets in the parent's qlen/backlog forever.

Patch 3 widens buffer_used and buffer_max_used to u64.  The u32
accumulator wraps once the resident truesize passes 2^32, bypassing the
over-limit drop loop while the configured limit is a u32 attribute; the
u32 MEMORY_USED export is clamped so widening the counter does not
truncate the reported value.

Patch 4 drops an unreachable 'nla_nest_end() < 0' error check: the
helper never returns a negative value.

All four are hardening for net-next (no Fixes:, no Cc: stable): the
counter wrap, the missing parent-backlog propagation and the
reconfiguration race all predate any contract we could anchor a
regression on.  Patches 1-2 were reported by Sashiko (gemini) and patch
3 comes from the gred 32-bit-wrap family; patch 4 is a static cleanup.

v1 -> v2:
 - Patch 1/4: drop atomic64_t; rate_bps stays a plain u64 with
   READ_ONCE()/WRITE_ONCE() annotations (per Toke's review: the accesses
   are plain loads/stores, so no atomic is needed).
 - Patch 2/4: no change; carries Toke's v1 Acked-by.
 - Patch 3/4: clamp the MEMORY_USED export to U32_MAX, so widening the
   counter does not truncate the u32 stat (Sashiko nipa Medium).
 - Patch 4/4: no change; carries Toke's v1 Acked-by.

Jamal Hadi Salim (4):
  net/sched: sch_cake: serialize reconfiguration with the datapath
  net/sched: sch_cake: reduce parent backlog when clearing a tin
  net/sched: sch_cake: widen buffer_used to u64
  net/sched: sch_cake: drop dead nla_nest_end() error check

 net/sched/sch_cake.c | 52 +++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 17 deletions(-)

-- 
2.43.0
Technical Details
Message-ID: <QDISC-5RTM.v2.r0.20261015051735@mojatatu.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346672-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346672-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 0/4] net/sched: sch_cake: fixes for accounting and reconfiguration
Date: Thu, 15 Oct 2026 06:32:41 -0400
Organization: Usenet Network
Message-ID: <QDISC-5RTM.v2.r0.20261015051735@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2509480"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:loGWThQZnIxZnRUcT8/cHeKLOEk= sha256:Nfh2Qmei0HtKBIsEufp/nz/2AVBvX6coKSZ0iXVQpOs=
	sha1:HJbYI2gGqOFRTmTy257Z7w537aE= sha256:OsmCEcKp3eQpHYWtw3i9JBU5le2W3J8GwfemWLEOnxw=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 235631102C2; Thu, 15 Oct 2026 13:42:06 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.75
X-Spam-Status: No, score=-0.75 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=mojatatu.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 3k35p864BFQs;
	Thu, 15 Oct 2026 13:42:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-346672-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 7A4DB1102A0; Thu, 15 Oct 2026 13:41:55 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 647832819E; Thu, 15 Oct 2026 10:32:54 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 4358947D933;
	Thu, 15 Oct 2026 10:32:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=mojatatu.com header.i=@mojatatu.com header.b="QTI4Ptc2"
X-Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61E154D09EC
	for <netdev@vger.kernel.org>; Thu, 15 Oct 2026 10:32:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792060373; cv=none; b=uW4jSAT6MICjQqS1NVqmvW/J9afASXvNSLX9glIiw9TAXnRy890Lz2CFe8wixSmoRMRGegL0E6+GB4AJhDmAGiNkyk7nRrDwtwaW+iBhDy4bV29evSPEbX9vLT7YDHYfVbhcvLiNYUuH7kYk5Y/1CxvogRU8LudFEfL50Heqnlc=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792060373; c=relaxed/simple;
	bh=eMV266QkYY8RlZ8C+nBcH3jrH0fic53m4ZGDmaazAgM=;
	h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=PK8oFAv/JQLblJbaL2Q9ZfRc6r5XnXmyxCjkUj63xPMThx7Z5QEDJC+rYW1avUcpQf7iBR9x30YZzTaZMDluLo+jf5JtFkGVtNv6Umcpf1HcgoxH+vq5So2x00NRXbHZeuB3KN4B4Py9f906aotVPhf407hdbtNWWPA9UUK5Qj8=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com; spf=none smtp.mailfrom=mojatatu.com; dkim=pass (1024-bit key) header.d=mojatatu.com header.i=@mojatatu.com header.b=QTI4Ptc2; arc=none smtp.client-ip=209.85.222.178
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=mojatatu.com
X-Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-93e76469b93so90228885a.0
        for <netdev@vger.kernel.org>; Thu, 15 Oct 2026 03:32:51 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=mojatatu.com; s=google; t=1792060370; x=1792665170; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=HbWQ31kC+1e1O6dmGLccpcVqgjxaFazqw0r7gj5HHA4=;
        b=QTI4Ptc2hjGoBrlA2PYQ+orM3cLeuH3gRmRTO+mJX4tLTu+kB9n9DDOM4QneojEF6P
         R7mSuV8RGi0U0QeRSWvhYeiRDLd+WeXFkWnP3HcvswXFeFjBsLj5BiedKeqkOPZMzYgu
         r+oHVqxJwAuEIBl6IFvrN0plrP8wkvmnai7ww=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792060370; x=1792665170;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=HbWQ31kC+1e1O6dmGLccpcVqgjxaFazqw0r7gj5HHA4=;
        b=H5QII0HRbaxOjZaWEI4nBWzzjoMO88Tda+bnRjzM5JaaR+3H/sRlBh/a4S594k/XEv
         qKrqVWMxA6ODa0hHprjCPoOHRqBjblXX4GPhyvsXUz/5ERYXEN+9fnHsODAwMmOajinG
         KEuY53+VbzG0vmQKK2JiOERArp+RMFvTuAc+W45z7z3xmjuU0Dr7TxaGnrkpBt9frkq0
         T4BX0T3Q+CBBk3k2BhsArrz6v6FtJvecz45EoP1N+HhOffOI7uSTzzZbOnh30vrNuPDt
         MEV33JDW85xlj0V7x+ZTJdLzmCaHeHmx0KD6cT26ATlGYyQlzM4xkU7NgxOZlUjuse9s
         IxKg==
X-Gm-Message-State: AFq9FYL+KFmc/RrLRR5XOUEl0O9W+nEwZU2lF2foYnU2LC4cUdx/5sde
	oNXFLMcCymVBKw3tjys7V/ddGLyypCI80qlY9oCXp3AfYAucW2mL3fpZnzz2GSZFht8WdvleVm1
	ecRM=
X-Gm-Gg: AYBFou2z63mTUaMpv17iaAJvlOMCdkdZGQahUHpmk/Wm/pVXo+nfSapUctlXBw/yNjG
	RJtYb33R9NKGorOiPQQd2n2R0pqiMMMbO7JWymLTvp5a7Sgi/JJgU0enlZhYkQYhc/BeiJBZ/FE
	hvzx6TkuG1Cw7Wbz0EvbXRObG6xUBYIxIJgb9bAF1CdUdDJ6OrJGesaCtW93YzJU8+0ltxkruIL
	YVDOB32uQCV8/B0kEddfnQtgOU19/O7qgFSrU7mg41l8VVJwXP7Hyy63OEMoeL2ZB3jCvk/uJ88
	qieiYW7PwNjQyvPtC9uzk2L5yUmR6vFSbC3d49fLikYVtvrp+Do3U4/JvgIUWfGM0aaFTLl5h71
	C2eS3Fwf6FBfG5niWsOp1MpTDeS9UC81O7uDiOe9E9WXYvxzq45JxrNceRmM3pIK8CdCqUSLZb+
	rP7P6XPYzlERDlzECk3DLTmC910d9mFNC6h0yWH8baujmaCvdBFgPfrDgJFSse13f5n+KMcCuN6
	WPXbEpmOtxr2bp8nsgplcLWkQe50R4AxtEWnxo4kMZW
X-Received: by 2002:a05:620a:170d:b0:936:e18d:763d with SMTP id af79cd13be357-93ebd0df184mr3132629085a.8.1792060370178;
        Thu, 15 Oct 2026 03:32:50 -0700 (PDT)
X-Received: from mbili.waya ([64.203.83.2])
        by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91ba684f404sm55261936d6.31.2026.10.15.03.32.48
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 15 Oct 2026 03:32:49 -0700 (PDT)
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Toke Høiland-Jørgensen <toke@toke.dk>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	cake@lists.bufferbloat.net,
	Victor Nogueira <victor@mojatatu.com>,
	Sashiko <sashiko-bot@kernel.org>
X-Mailer: git-send-email 2.34.1
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>