From 21ac6e5edac569df3938b136471c59c1d3d01f09 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Thu, 10 Apr 2025 14:37:31 -0700 Subject: [PATCH] ratelimit: Don't flush misses counter if RATELIMIT_MSG_ON_RELEASE Restore the previous semantics where the misses counter is unchanged if the RATELIMIT_MSG_ON_RELEASE flag is set. Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/ Link: https://lore.kernel.org/all/20250423115409.3425-1-spasswolf@web.de/ Signed-off-by: Paul E. McKenney Reviewed-by: Petr Mladek Cc: Andrew Morton Cc: Kuniyuki Iwashima Cc: Mateusz Guzik Cc: Steven Rostedt Cc: John Ogness Cc: Sergey Senozhatsky --- lib/ratelimit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ratelimit.c b/lib/ratelimit.c index 7d4f4e241213e..4e520d029d28f 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c @@ -92,9 +92,9 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) atomic_set(&rs->rs_n_left, rs->burst); rs->begin = jiffies; - m = ratelimit_state_reset_miss(rs); - if (m) { - if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) { + if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) { + m = ratelimit_state_reset_miss(rs); + if (m) { printk_deferred(KERN_WARNING "%s: %d callbacks suppressed\n", func, m); } -- 2.47.2