On 11/29/18 12:42 PM, Omar Sandoval wrote:
> On Thu, Nov 29, 2018 at 12:34:12PM -0700, Jens Axboe wrote:
>> If we aren't forced to do round robin tag allocation, just use the
>> allocation hint to find the index for the tag word, don't use it for the
>> offset inside the word.
>
> Maybe also add "We're already fetching that cache line, so we might as
> well check the whole word."
Sure, will add.
>> @@ -130,12 +139,8 @@ int sbitmap_get(struct sbitmap *sb, unsigned int
>> alloc_hint, bool round_robin)
>>
>> /* Jump to next index. */
>> index++;
>> - alloc_hint = index << sb->shift;
>> -
>> - if (index >= sb->map_nr) {
>> + if (index >= sb->map_nr)
>> index = 0;
>> - alloc_hint = 0;
>> - }
>
> We need to set alloc_hint = 0 here for the round_robin case.
Good point, does need a reset for the loop for that case.
--
Jens Axboe