Skip to content

Improve the performance of bitmap_find_next_zero_area_off()

Yi Sun lkml 8 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest2 patches 0 repliesNew
  2. v72 patches 7 repliesSuperseded
  3. v62 patches 1 replySuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v52 patches6 repliesSuperseded
v42 patches10 repliesSuperseded
v32 patches8 repliesSuperseded
v21 patch0 repliesSuperseded
v12 patches6 repliesSuperseded

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2lib: bitmap: add tests for bitmap_find_next_zero_area_off()lib/find_bit_benchmark.c lib/test_bitmap.c+55 -00 replies
2/2lib: bitmap: optimize bitmap_find_next_zero_area_off()lib/bitmap.c lib/test_bitmap.c+18 -170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v8 yet.

Read the v8 thread

Cover letter [PATCH v8 0/2] Improve the performance of bitmap_find_next_zero_area_off()

Use lib/find_bit_benchmark.c for testing. Test results showed a 40% improvement in dense cases, and almost no change in sparse cases.

Performance test results on my hardware:
before(ns) after(ns) change p-value
dense 1211 688 -43.2% 8.3e-11
sparse 13.3 13.4 0.8% 0.27

Version 8 improve test code.
When original bitmap_find_next_zero_area_off() fails, it returns end, where end is greater than size. Therefore, patch1 should use >. expect_eq_uint(1,

	bitmap_find_next_zero_area_off(bmap, 192, 0, 33, 0, 0) > 192);

When new bitmap_find_next_zero_area_off() fails, it returns size. Therefore, patch2 should be changed to =. expect_eq_uint(192,

	bitmap_find_next_zero_area_off(bmap, 192, 0, 33, 0, 0));

---
v7: https://lore.kernel.org/all/[email protected]
- Only changed the alignment format of the test code.

v6: https://lore.kernel.org/all/[email protected]
- Improve test code.
- Change infinite for loop to for_each_clear_bit_from.

v5: https://lore.kernel.org/all/[email protected]
- Improve test code.
- Change the "goto again" code structure to a for loop.

v4: https://lore.kernel.org/all/[email protected]
- Test code has been added to PATCH v2.

v3: https://lore.kernel.org/all/[email protected]
- Code optimization was performed on PATCH v1.

v2: https://lore.kernel.org/all/[email protected]
- Do not introduce find_last_bit_from().

v1: https://lore.kernel.org/all/[email protected]

Yi Sun (2):
lib: bitmap: add tests for bitmap_find_next_zero_area_off()
lib: bitmap: optimize bitmap_find_next_zero_area_off()

 lib/bitmap.c             | 31 ++++++++++++++++---------------
 lib/find_bit_benchmark.c | 17 +++++++++++++++++
 lib/test_bitmap.c        | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 15 deletions(-)
Signature · 1 line
2.34.1