public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Omar Sandoval <osandov@osandov.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH] sbitmap: don't loop for find_next_zero_bit() for !round_robin
Date: Thu, 29 Nov 2018 12:44:06 -0700	[thread overview]
Message-ID: <627d7320-dcd5-43c2-74ae-72fbecf951c0@kernel.dk> (raw)
In-Reply-To: <20181129194236.GA21082@vader>

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


      reply	other threads:[~2018-11-29 19:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 19:34 [PATCH] sbitmap: don't loop for find_next_zero_bit() for !round_robin Jens Axboe
2018-11-29 19:42 ` Omar Sandoval
2018-11-29 19:44   ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=627d7320-dcd5-43c2-74ae-72fbecf951c0@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=osandov@osandov.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox