Re: [PATCH net-next v3 2/5] netconsole: add a per-target message rate limit

From
Gustavo Luiz Duarte <gustavold@gmail.com>
Date
2026-09-23 15:38:55
Also in
linux-kselftest, lkml, netdev
Reply to
Breno Leitao, 2026-09-14
On Mon, Sep 14, 2026 at 1:10 PM Breno Leitao [off-list ref] wrote:
Give each target a token bucket and consult it once per message in
netconsole_write().

The bucket is created with a zero interval, which struct ratelimit_state
treats as unlimited, and nothing can set a nonzero one yet, so no target
changes behaviour.

Skip the bucket while the kernel is dying, reusing the helper the
oops_only fix added, so a limit configured for steady-state logging
never truncates an oops, BUG() or panic().

The configfs files that expose it come next.

___ratelimit() only trylocks its own raw spinlock, so it is safe with
target_list_lock held and interrupts disabled, and safe from NMI. Set
RATELIMIT_MSG_ON_RELEASE so it does not report the suppressed count
itself, which would printk() from inside the console being serviced.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Thread (11 messages) 11 messages, 2 authors, last reply 2026-09-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help