🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5465

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

#5465
From: Jamal Hadi Salim
Date: Tue, 20 Oct 2026 11:00
66 lines
13816 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.

v2 -> v3:
 - Patch 1/4: reuse the rate snapshot in cake_dequeue() and
   cake_reconfigure() instead of a second READ_ONCE() per use, order the
   declarations longest-first (Björn Töpel), and scope the annotation
   claim: READ_ONCE()/WRITE_ONCE() do not make a 64-bit access
   single-copy atomic on 32-bit, so the lockless cake_config_dump() and
   cake_mq readers remain best-effort (Sashiko nipa).
 - Patch 2/4: no change; carries Toke's v1 Acked-by.
 - Patch 3/4: publish buffer_max_used as u64_stats_t under the qdisc lock
   and snapshot it with u64_stats_fetch_begin()/retry(), so the lockless
   stat read is coherent on 32-bit (Sashiko gemini + nipa).
 - Patch 4/4: no change; carries its Reviewed-by and Acked-by tags.

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 | 69 ++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 50 insertions(+), 19 deletions(-)

-- 
2.43.0
Technical Details
Message-ID: <QDISC-5RTM.v3.r0.20261020053711@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-349228-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-349228-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 0/4] net/sched: sch_cake: fixes for accounting and reconfiguration
Date: Tue, 20 Oct 2026 07:00:04 -0400
Organization: Usenet Network
Message-ID: <QDISC-5RTM.v3.r0.20261020053711@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3840841"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:HTJkB24C3MvcaMGJzRQCMy6DtrM= sha256:MUqSnnxLWJ4/dgRJT8Cyt/0/T8psQPsQp9oqLQLChuw=
	sha1:x28kHVcunoWW7HdNUefnSjUkZ88= sha256:qg5oSXF1BIfS677yQb7TMEyjAFiEd3Sdja1uovR0+Gk=
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 4DD74110CC5; Tue, 20 Oct 2026 14:20:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=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 ktfkZBot7GzH;
	Tue, 20 Oct 2026 14:20:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-349228-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 5A80B110CC0; Tue, 20 Oct 2026 14:20:20 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 95F6B2A4F4; Tue, 20 Oct 2026 11:00:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792494015;
	b=WLTxhYHAFqFrVEEiByhfPV809rJfpS3r+OThPdg9T5BIC5LN2sQScggmhXZ81CPq6Hph
	 iW5e/L1J4KGKAgJzQ6humfsFbsKouxBHKYdTotpPkVnYEwPDG7bd15/IaULGBwJ4mI7yk
	 wYWusloZz6qefz2POHCLFlQW9kFhz9BOlIEvb7qKavlnWa7SYn8i7BIsSyYXV1O4BJHk7
	 DtLLzVNLwKkbZPvzPV21P34V78uVoWHZLjqKjaJk4b8UBs6gFKPxslPuWrIYf3QZZJYHA
	 nSolETY1jMugxtTAeJDs4yvCQlzUZDDN5uJdTM3dNU6ZlbF2S+70YD63DK4HXTE+abQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792494015;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=KOzquRVJX7CuCnTjfd7MDQSX824d3kGTwCuJPFcsHFw=;
	b=bOQqlcvcjYsG2uScflKFVejunCmB7ulwbW2tpBilxZ9PBwLUolucupPAwRN+JFgrm0pl
	 1CF6D1M9G0IiZU/YUmOgk5OnZBsFfq+bMEYXhmghh9qp8TmG0F3c/DDvbiSDHQSQ/uAbX
	 pVdf1ZFKar8RB9J2Q8rl0N1NMcq4i9X72IwjrjR648fmKqLHHsK8vaLXKkt14mDdFNGMC
	 /v/eo97TZaKtmjP80mkvNd7+Lf1HqNy2g0YXXkZAnC7OeiRDPw3PN59Jdxu1Ho6yHmcLA
	 ey6LkN4p5S71ZuUUC6XZIK2u3shRRcdTFMqfLsOgujVGWZ9JZ6cy/EU4oH5UfKSfTpQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=W3iOg25e;
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 60688606A33C;
	Tue, 20 Oct 2026 11:00:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=W3iOg25e
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792494014;
	b=05+jG2AMcU0QYHIBpaEuQVFThC/tD/e4V8miHGXVWQbeY9yn0ArZhsX1IeZZpWhrrOru
	 IdCfK8cu7iqvHvPMAGjHeP0trb5TUjmZKGUP7yyWA5X+64apF5itxkSZpi1hljwwaQO+5
	 AKjeW9I8GYhwBKUgqKI+gEbuRXL/r7BIHtnfcMQHv6cSVMEg99ZDe1T9BEh3GWqyIGSkC
	 y8HTgF1LgjqZz4ugAIUmk7yOvzZp/gEzN685gDmSXLN+LVAtutpk2/qUZZ2/wD5rVfMPr
	 JJFs2Q74eNxCYhtIJxyfec8E0bGxQnP/tOaJoXp+lAK6HIs0pbajRlckwDQgTNRTFpA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792494014;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-Id:X-Mailer:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=KOzquRVJX7CuCnTjfd7MDQSX824d3kGTwCuJPFcsHFw=;
	b=XZCRABKizvEYj3DRupbIUG4kbt2ecenhRpdjTbTlxmJJSLNqyNVpxrmWH0mU3WFUO54N
	 bwZXMvtzh/aIyOuVYuH+P2pl0RIVUEsr9/X1DHC3cR2RfpRipw56VPQBLi9U7Q8zrBQsT
	 15RyvIt5NZSva9qkQQ5ibqBhBrM6NNwecI5FSCwXmsjii83AuwFmU8JEzBQMBye4Th20l
	 c9dNE2/FScP94RAKpYGLZ05iFrlsJzWlTMtex0kmNtC/Y61pOuORlY89naVXQcYBb+JeS
	 HuI47rDfJROG4SU238D7xGKUFpTCmx+gZ+AnhCNtZaic8qhXinwCNg9xpi5O7BcojQg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=W3iOg25e;
	arc=none smtp.remote-ip=209.85.222.182
X-Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF082606A327
	for <netdev@vger.kernel.org>; Tue, 20 Oct 2026 11:00:13 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EF082606A327
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-f182.google.com with SMTP id af79cd13be357-93f22a8515eso286698985a.2
        for <netdev@vger.kernel.org>; Tue, 20 Oct 2026 04:00:13 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=mojatatu.com; s=google; t=1792494013; x=1793098813; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:mime-version:message-id:date
         :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=KOzquRVJX7CuCnTjfd7MDQSX824d3kGTwCuJPFcsHFw=;
        b=W3iOg25eukv4Ju9RqklfduXdwfUiupJuI0rYieV9xhm3gmDOW5qfuVrfBj2Phle1UY
         N5gWTxC+NUJ7kamJj8b7b3ps0JdbYkmOxo1jq0pVpYqKw3MWMnDDfGFzyU959ycqPab1
         7FzXVIlM8TGLyjNvsBjC3B4nySEJRodGnYUi8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792494013; x=1793098813;
        h=content-transfer-encoding:content-type: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=KOzquRVJX7CuCnTjfd7MDQSX824d3kGTwCuJPFcsHFw=;
        b=K83ziz/wQS9zXUJW2LxubFtbeHHcHyhgQxVANHb7KQ1zG72+75yTwrhsiSXbRh24/y
         gT/DpSuAO4VIcAK6lTsu3yySpMphmonC/y2o4foxuqxnFwuNYhEEv8d7PseaxqYOzgkp
         3dXqovLy7IZlO2SJi6K6nl/C5b8+Lz8sb3l7wN9Wenxx4sjStQ2+JkWLvi8zxwmqSWiG
         +p8Zz59OnVTbJwvt8U4CdYR2o+q4oHMjPRoCAsn37K/ib5rqHFlOyxnXxeZ+oCZtsIzs
         lRx5IFPZIaGFkd6IplZp5uutPgGFbklj+0jP1elEnb3UHrFDosvjuNXmpIFp0B7gr/tC
         B0uw==
X-Gm-Message-State: AFq9FYIhAwtEgt4/AZs3Rw+LvugmktxrWRpG0jE1O6BsbM2IxilTWf0J
	9K6FFDcZgIkkeSrjxG5BA1NGLFBQwnMqGLKOQ8AbfpqXjKa7SJseJH9g57Z3P0i7f8jqMsXoXq3
	Ae+g=
X-Gm-Gg: AYBFou3oUJsxNOQE+EmUGj3pUStDkF11EHMxbs73GlALVe0DXm9zApACMG3z85NmuyI
	z1RJbXyYlO/Z0g1kN4iAPtPMOeq/iw+fXWdDril3+gW96Cg5XbA6uk+j3rHe94zwjKku4VzinHb
	icQSO54Gd4e1R87+DHm0iMBZOM8zcBpEjz+7gUNCZHKx3yNbRPi53Ws23x5MDx+PHWyiyLJz+fV
	aofK9Fqtz00+htDdX8yViG9nFuE77kS/NYFsqUrgX6k2SQ0ElWeGLFgGCGxnD46zrR640yxeaRs
	gNzhh9zezT9Qa3J/oNKigFSPL8EK8opT2QKHfVHW9sHwe8jOa1UVJ3CjCz1GoKP6SP9BFf5TIFk
	+oDgq+iSIm16P0v4R9oKdjfXlcVG71+gTME6f+SAK3NZQN+/thK3zfmFpiWcw0YQ9qCZmIDPYnc
	+dBqhvP4J8kZ9/O7eCm9gWlz+fpqjXqDws9Nl7WzIvhgtUEcxAQXdBxyYHW1x9STOCfyheWf6r/
	jBBD3MjHXshb7nQFurr1VY1pYZ8jrOl/vq4W5apUJ/0
X-Received: by 2002:a05:620a:270b:b0:93e:623d:99ec with SMTP id af79cd13be357-93f29c94085mr1741356885a.13.1792494012590;
        Tue, 20 Oct 2026 04:00:12 -0700 (PDT)
X-Received: from mbili.waya ([64.203.83.2])
        by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91c040e6667sm23382356d6.39.2026.10.20.04.00.11
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 20 Oct 2026 04:00:12 -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-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list