๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24669

Re: [PATCH net-next 2/4] net/sched: sch_cake: dither the flow quantum from a per-tin generator

#24669
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 15:46
67 lines
10370 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message for "net/sched: sch_cake: dither the flow
  quantum from a per-tin generator" gives a performance motive but noโ€ฆ

--

net/sched: sch_cake: dither the flow quantum from a per-tin generator

This patch replaces the get_random_u16() dithering addend in
cake_get_flow_quantum() with a value taken from a per-tin struct rnd_state.
cake_init() seeds that state from get_random_u64() for each tin.

> CAKE adds a random 16-bit value to every flow quantum it hands out, so
> that the scaled quantum does not accumulate a rounding error. That is a
> get_random_u16() for nearly every packet dequeued, while the dithering
> needs no more than a uniform value.

[Severity: Low]
This isn't a bug, but are there any measurements behind the performance
motivation here? The commit message has no cycle counts, pps figures or
perf profile showing that get_random_u16() costs anything noticeable in
cake_get_flow_quantum().

get_random_u16() already draws from a batched per-CPU buffer. The patch also
adds a struct rnd_state to each struct cake_tin_data and moves this call
from the system CSPRNG to prandom. Without numbers it is hard to tell what
the change gains.

Is "nearly every packet dequeued" accurate? In net/sched/sch_cake.c,
cake_get_flow_quantum() has only two callers. In cake_dequeue() it runs
only when the deficit is refilled:

cake_dequeue() {
    ...
	if (flow->deficit <= 0) {
		...
		WRITE_ONCE(flow->deficit,
			   flow->deficit + cake_get_flow_quantum(b, flow, q->config->flow_mode));
    ...
}

The second caller is cake_enqueue(), when a flow is activated as sparse. The
commit message does not mention this one:

cake_enqueue() {
    ...
		WRITE_ONCE(flow->deficit, cake_get_flow_quantum(b, flow, q->config->flow_mode));
    ...
}

So the number of calls per dequeued packet is roughly pkt_len divided by
the scaled quantum. cake_set_rate() clamps flow_quantum to 300..1514 bytes,
and the quantum is then divided by host_load. Bulk MTU-sized or GSO traffic
gets one or more calls per packet. Small packets such as ACKs get far fewer
than one.

Could the commit message describe the call frequency more precisely and
include numbers that show the benefit?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129151144.2194312-1-julius%40bairaktaris.de
Technical Details
Message-ID: <179605360435.3146.7564718396376708562@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374282-linux-kernel-netdev=dewy.ru
References: <20261129151144.2194312-3-julius@bairaktaris.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374282-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 2/4] net/sched: sch_cake: dither the flow quantum
 from a per-tin generator
Date: Mon, 30 Nov 2026 15:46:44 +0000
Organization: Usenet Network
Message-ID: <179605360435.3146.7564718396376708562@kernel.org>
References: <20261129151144.2194312-3-julius@bairaktaris.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1459765"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:JwY+E5LG6DJ15OrUZAc/GcAILtU= sha256:M1p0j5Ao4++GCGJAvZkPqc4EJHMmzL4vv86sM3CCXf0=
	sha1:RlwtlEJ1bg292M3QTwk8ton/K50= sha256:86V1LC0KmYkE9PIvmsf5ZZ9nS6Z4zPgqAI+PDFkACsw=
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 35259125FF4; Mon, 30 Nov 2026 18:47:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 AXBpfjLSSmB2;
	Mon, 30 Nov 2026 18:47:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374282-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 90B49125FED; Mon, 30 Nov 2026 18:47:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 59DFF32C15; Mon, 30 Nov 2026 15:46:52 +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=1796053606;
	b=q5H+xknZueCIXht40HNGB+SfWgblZ3hjHjAefQX4v0fb1zFfGsA43aaJQGGLFlin4qqu
	 PGxOxJJVmrhfNmUucI6ASvqD6Dnnm6L9aZWlsGfu/QKFDBkdqQX1/1Y4tQoNUXdhSwRmJ
	 9Tha203ZHV83wwoU1gWQp67WkOfPY7j9ZWdA1GNZPgPYEGomHcdXvfxi6x45qZIc/UjpG
	 QjgjjJc678L2g+oXMBFfo+bYD8DfTxwqqk3KGfEffngveQZPN4n8i8pzlmitVQSR+AA+O
	 +dhNpNAvRcVjIIC0uFxRVt2Slflf5aeCOvctIlJK/eUF24NSNwaW8S0J0r2zqSbZmhA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796053606;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=ujYbMwnj0TXKoM7a8OnsnST5mkbXWpphlSNIo7JuIwM=;
	b=Itp0jtsRqqyloutx2QqZFjSRxC0Up9R6Asyw7nwiGHRNrqjho1jt/OB7xAZ7LzslOqQH
	 I7G6oTBVZptsM1ehN6UDMKyZTFw/eigdXaCr8y/655lNXuVCqVZpRyN0atB3N2zit6mJp
	 C5F9rjmCFpngO7mewOpdsZAFXK3bCZtweOsBabi0Qyjzm0PXUd4xmJ2RsHOYN5EGCGZdL
	 JacddtZAlw55o5AAwmtGUG/ElS+k60iEYGaFoY6ZsiyqydMfd3A92i57yiZ6bympRpbsR
	 IvDFEXvSpnNy1rG5OILqFNZ5OO1R05lPMrqFOLrAYhBNnKdV8w3XBuB4w3GyMD/YBvA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QpqvNuoA;
	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 AAEE6606A331;
	Mon, 30 Nov 2026 15:46:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QpqvNuoA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796053605;
	b=KWuGy9DjPyiL+S+vulH01a0OwyepAlYADgcQpLldU3mQ8ymFtS7oKaqBrbMvFY46T1QK
	 bw/TFEfXVosiYxOze3ittlJzPozIYVJgA6xyoqiEqn6xR+4QG7OWmohRL8wzeL4OwJ8CF
	 +sxqQxyvT5DQ1y+QZnm33gN3LiBK6yPaYB11V8b3IS3fOX4bSfjTmJqJ4fdce7efZQbzo
	 9CwdQHDmmCxOUOhQXnVkjeYE9tpGrGjgHN2x9sG8ms8EGGOWAnEfoWll7alJIZ1g8RblF
	 d5C3UkMLlFsymuIOLZ8whVZPUwLQega+oxUoP8/Wj8D7P+KVHJ67GGDyO7aDZBV+VvQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796053605;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=ujYbMwnj0TXKoM7a8OnsnST5mkbXWpphlSNIo7JuIwM=;
	b=rBsYizsy6AbfWuywG+SficohU9+KGhkpy8kWEdyD/Sg1u0HXOzuJVnOGXYo0dXrwZnIQ
	 MZk6eTWnN9Xoa/VNb8DxCDS22CAcCB0+nosQdu77RzPb8vT4F/t8wr6vAL+xz44dHsqJB
	 YCmXEAWVXUTD/MihbBdaHdwzb8kEmZGZagsQQfsBM6YZ5UUgeCr42MD/Qh5QMHRzs/PDh
	 4CVwubj6lmMCHIBWTMos2MPYlGDJlbOn4mYs2QFC2Cuq3omfXIhHrmIZYeMhYjmfgr8uZ
	 CYGOtLwbGKRXIXPWYJfx2lps2iiNWSOqmDZE56tplefUgYpJwgygdcJx9I9iLWD/rQg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QpqvNuoA;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBAE0606A692
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 15:46:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF5831F00931;
	Mon, 30 Nov 2026 15:46:44 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796053605;
	bh=ujYbMwnj0TXKoM7a8OnsnST5mkbXWpphlSNIo7JuIwM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=QpqvNuoAM8fCI1XLPmnPZO9YlhU8SrEk4EJjQ5lqJS2YXVNGLocQNTN1k8h+XDSDB
	 XQaBEeiUSPdWakpXnXNTi1ZF29YxIYpwGAd7XmRQQdqeI96GuJN9QbWpTPkp3qTdXC
	 EOc+opbLM+MIqOeXSU9+p7WcjllqM0FAj5G5pfDbePMqQW4zKAemuAGI9KRbA1HIUZ
	 3IIAdzmf/h+1sPAr+E9EKRj5o8ACzg63qOCMrZAplo8CKIYIWzkSCRi0UrYNx0I5t6
	 tXLs1O7Iy04frxWJlFqFedwC7oBk9x93rrxg6FQYexXu/nc3QjbJZ7U5KjNYrzA0sw
	 0tEeaJz8ESvXw==
X-Cc: toke@toke.dk, netdev@vger.kernel.org, jhs@mojatatu.com, jiri@resnulli.us,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 willemb@google.com, horms@kernel.org, victor@mojatatu.com
X-In-Reply-To: <20261129151144.2194312-3-julius@bairaktaris.de>
X-sashiko-severity: Low
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