Skip to content

Commit ba575ce

Browse files
committed
ratelimit: Drop redundant accesses to burst
Now that there is the "burst <= 0" fastpath, for all later code, burst must be strictly greater than zero. Therefore, drop the redundant checks of this local variable. Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/ Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Kuniyuki Iwashima <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: John Ogness <[email protected]> Cc: Sergey Senozhatsky <[email protected]>
1 parent 4b2cce9 commit ba575ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/ratelimit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
5858
* the current lock owner is just about to reset it.
5959
*/
6060
if (!raw_spin_trylock_irqsave(&rs->lock, flags)) {
61-
if (READ_ONCE(rs->flags) & RATELIMIT_INITIALIZED && burst &&
61+
if (READ_ONCE(rs->flags) & RATELIMIT_INITIALIZED &&
6262
atomic_read(&rs->rs_n_left) > 0 && atomic_dec_return(&rs->rs_n_left) >= 0)
6363
ret = 1;
6464
goto nolock_ret;
@@ -90,7 +90,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
9090
}
9191

9292
/* Note that the burst might be taken by a parallel call. */
93-
if (burst && atomic_read(&rs->rs_n_left) > 0 && atomic_dec_return(&rs->rs_n_left) >= 0)
93+
if (atomic_read(&rs->rs_n_left) > 0 && atomic_dec_return(&rs->rs_n_left) >= 0)
9494
ret = 1;
9595

9696
unlock_ret:

0 commit comments

Comments
 (0)