Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: julius@bairaktaris.de
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
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	[thread overview]
Message-ID: <179605360435.3146.7564718396376708562@kernel.org> (raw)
In-Reply-To: <20261129151144.2194312-3-julius@bairaktaris.de>

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

  reply	other threads:[~2026-11-30 15:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 15:11 [PATCH net-next 0/4] net/sched: sch_cake: per-packet cost of a shaping CAKE Julius Bairaktaris
2026-11-29 15:11 ` [PATCH net-next 1/4] net/sched: sch_cake: give the shaper timer slack Julius Bairaktaris
2026-11-30 15:46   ` netdev-bot+sashiko
2026-11-29 15:11 ` [PATCH net-next 2/4] net/sched: sch_cake: dither the flow quantum from a per-tin generator Julius Bairaktaris
2026-11-30 15:46   ` netdev-bot+sashiko [this message]
2026-11-29 15:11 ` [PATCH net-next 3/4] net/sched: sch_cake: keep short GSO aggregates whole Julius Bairaktaris
2026-11-30 15:46   ` netdev-bot+sashiko
2026-11-29 15:11 ` [PATCH net-next 4/4] net/sched: sch_cake: skip the dissection for a packet of an active flow Julius Bairaktaris
2026-11-30 15:46   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179605360435.3146.7564718396376708562@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=julius@bairaktaris.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=toke@toke.dk \
    --cc=victor@mojatatu.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox