Re: [PATCH] sbitmap: don't loop for find_next_zero_bit() for !round_robin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux