Skip to content

ratelimit: Add tests for lib/ratelimit.c

Paul E. McKenney amd-gfx dri-devel intel-gfx lkml 5 versions – Applied

Status from this message: [merged] lib-add-stress-test-for-ratelimit.patch removed from -mm tree

Get series with b4
b4 am d1007957-97ff-4f6f-92ac-606f68c65dfa@paulmck-laptop

Versions newest first · linked by author and title

  1. v6 Latest3 patches 5 repliesApplied 3/3
  2. v521 patches 2 repliesSuperseded
  3. v420 patches 4 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v320 patches14 repliesSuperseded
v214 patches9 repliesSuperseded

Patches in v6 All 3 applied

#Subject and filesSizeRepliesApplied
1/3lib: Add trivial kunit test for ratelimitlib/Kconfig.debug lib/tests/Makefile lib/tests/test_ratelimit.c+91 -03 repliesApplied
2/3lib: Make the ratelimit test more reliablelib/tests/test_ratelimit.c+4 -42 repliesApplied
3/3lib: Add stress test for ratelimitlib/tests/test_ratelimit.c+67 -20 repliesApplied

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchPetr Mladek
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/3] ratelimit: Add tests for lib/ratelimit.c

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(-)