Message ID | 20230720094555.1397621-4-chengming.zhou@linux.dev (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | sbitmap: fix offset hint wrap and some optimizations | expand |
diff --git a/lib/sbitmap.c b/lib/sbitmap.c index ccb96d1f92ba..0f3943bd3940 100644 --- a/lib/sbitmap.c +++ b/lib/sbitmap.c @@ -268,7 +268,9 @@ static int __sbitmap_get_shallow(struct sbitmap *sb, unsigned int index; index = SB_NR_TO_INDEX(sb, alloc_hint); - alloc_hint = SB_NR_TO_BIT(sb, alloc_hint); + + /* No point in looping twice in find_next_zero_bit() for this case. */ + alloc_hint = 0; return sbitmap_find_bit(sb, shallow_depth, index, alloc_hint, true); }