Hello!
This v6 series adds a simple "smoke" test along with a simple stress test:
1. Add trivial kunit test for ratelimit.
2. Make the ratelimit test more reliable, courtesy of Petr Mladek.
3. Add stress test for ratelimit.
Thanx, Paul
Changes since v5:
o Drop patches that have since been accepted into mainline.
o Add Petr Mladek's patch improving the reliability of the simple
test.
Changes since v4:
o Add a simple stress test.
o Move the tests to the end of the series for bisectability.
o Add Reviewed-by tags.
Changes since v3:
o Correctly handle zero-initialized ratelimit_state structures,
being careful to avoid acquiring the uninitialized ->lock.
o Remove redundant checks of the "burst" local variable.
o Add Reviewed-by tags.
Changes since v2:
o Apply feedback from Bert Karwatzki, Srikanth Aithal, and Mark
Brown, fixing a hang that happened on some systems.
o Applied Reviewed-by tags and added links.
o Added a prototype patch from Petr Mladek that splats if either
interval or burst are negative.
o Added several commits that simplify the code.
Changes since v1 (RFC):
o Switch from lockless fastpath to carrying out needed updates
upon trylock failure, per Petr Mladek feedback. This greatly
simplifies the code and is a much smaller change from the
current code. There is a small performance penalty compared to
the lockless fastpath, but not enough to matter.
o Never unconditionally acquire the lock, again per Petr Mladek
feedback.
o Better define effects of non-positive burst values (always
ratelimit) and non-positive interval values (never ratelimit
when the burst value is positive).
o The changes from Petr's original are supplied as five incremental
patches, but could easily be folded into Petr's original if
desired. (Left to my lazy self, they stay as-is.)
------------------------------------------------------------------------
b/lib/Kconfig.debug | 11 +++++
b/lib/tests/Makefile | 1
b/lib/tests/test_ratelimit.c | 79 +++++++++++++++++++++++++++++++++++++++++++
lib/tests/test_ratelimit.c | 77 ++++++++++++++++++++++++++++++++++++++---
4 files changed, 162 insertions(+), 6 deletions(-)