diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2025-04-16 09:34:14 -0700 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2025-05-08 16:13:27 -0700 |
commit | 96d366048fed6a70accf4ddb55c4c65ab27aa48f (patch) | |
tree | 615e0a66e156c13b55cdad74735247f29fead4f7 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 123a1d97b2baf9eba9662a5f65660edc317e0bb8 (diff) |
ratelimit: Avoid atomic decrement under lock if already rate-limited
Currently, if the lock is acquired, the code unconditionally does
an atomic decrement on ->rs_n_left, even if that atomic operation is
guaranteed to return a limit-rate verdict. A limit-rate verdict will
in fact be the common case when something is spewing into a rate limit.
This unconditional atomic operation incurs needless overhead and also
raises the spectre of counter wrap.
Therefore, do the atomic decrement only if there is some chance that
rates won't be limited.
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 <paulmck@kernel.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions