diff options
author | Jason Evans <jasone@canonware.com> | 2017-03-25 05:46:56 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2017-03-26 06:29:32 (GMT) |
commit | 5e12223925e3cbd1f7c314e9d0224e1fa597ccc7 (patch) | |
tree | 0b5f4311a1df12ff8ef73911947607538b5813fa /include | |
parent | e6b074472e4515a74b1e8062bd94683cc8f5b3ba (diff) | |
download | jemalloc-5e12223925e3cbd1f7c314e9d0224e1fa597ccc7.zip jemalloc-5e12223925e3cbd1f7c314e9d0224e1fa597ccc7.tar.gz jemalloc-5e12223925e3cbd1f7c314e9d0224e1fa597ccc7.tar.bz2 |
Fix BITMAP_USE_TREE version of bitmap_ffu().
This fixes an extent searching regression on 32-bit systems, caused by
the initial bitmap_ffu() implementation in
c8021d01f6efe14dc1bd200021a815638063cb5f (Implement bitmap_ffu(), which
finds the first unset bit.), as first used in
5d33233a5e6601902df7cddd8cc8aa0b135c77b2 (Use a bitmap in extents_t to
speed up search.).
Diffstat (limited to 'include')
-rw-r--r-- | include/jemalloc/internal/bitmap_inlines.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/jemalloc/internal/bitmap_inlines.h b/include/jemalloc/internal/bitmap_inlines.h index 07166ba..b4a5ca0 100644 --- a/include/jemalloc/internal/bitmap_inlines.h +++ b/include/jemalloc/internal/bitmap_inlines.h @@ -112,6 +112,19 @@ bitmap_ffu(const bitmap_t *bitmap, const bitmap_info_t *binfo, size_t min_bit) { group &= group_mask; } if (group == 0LU) { + /* + * If min_bit is not the first bit in its group, try + * again starting at the first bit of the next group. + * This will only recurse at most once, since on + * recursion, min_bit will be the first bit in its + * group. + */ + size_t ceil_min_bit = (min_bit + + BITMAP_GROUP_NBITS_MASK) & ~BITMAP_GROUP_NBITS_MASK; + if (ceil_min_bit != min_bit && ceil_min_bit < + binfo->nbits) { + return bitmap_ffu(bitmap, binfo, ceil_min_bit); + } return binfo->nbits; } bit = (bit << LG_BITMAP_GROUP_NBITS) + (ffs_lu(group) - 1); |