From: Hannes Reinecke <hare@suse.de>
To: John Garry <john.garry@huawei.com>, Jens Axboe <axboe@kernel.dk>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Ming Lei <ming.lei@redhat.com>,
Bart van Assche <bvanassche@acm.org>,
linux-scsi@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 3/8] blk-mq: Use a pointer for sbitmap
Date: Wed, 27 Nov 2019 17:52:54 +0100 [thread overview]
Message-ID: <58875c2b-5141-b8be-a086-4fa29137d1e6@suse.de> (raw)
In-Reply-To: <dbd917cc-f8a2-a410-5c2b-79670ede440d@huawei.com>
On 11/27/19 3:44 PM, John Garry wrote:
> On 27/11/2019 14:21, Jens Axboe wrote:
>> On 11/27/19 6:05 AM, John Garry wrote:
>>> On 27/11/2019 01:46, Jens Axboe wrote:
>>>>>> Would be interesting to check the generated code for that, ideally
>>>>>> we'd
>>>>>> get rid of the extra load for that case, even if it is in the same
>>>>>> cacheline.
>>>>>>
>>>>> I checked the disassembly and we still have the load instead of the
>>>>> add.
>>>>>
>>>>> This is not surprising, as the compiler would not know for certain
>>>>> that
>>>>> we point to a field within the same struct. But at least we still
>>>>> should
>>>>> point to a close memory.
>>>>>
>>>>> Note that the pointer could be dropped, which would remove the
>>>>> load, but
>>>>> then we have many if-elses which could be slower, not to mention that
>>>>> the blk-mq-tag code deals in bitmap pointers anyway.
>>>
>>> Hi Jens,
>>>
>>>> It might still be worthwhile to do:
>>>>
>>>> if (tags->ptr == &tags->__default)
>>>> foo(&tags->__default);
>>>>
>>>> to make it clear, as that branch will predict easily.
>>>
>>> Not sure. So this code does produce the same assembly, as we still need
>>> to do the tags->ptr load for the comparison.
>>
>
> Hi Jens,
>
>> How can it be the same? The approach in the patchset needs to load
>> *tags->ptr, this one needs tags->ptr. That's the big difference.
>>
>
> In the patch for this thread, we have:
>
> @@ -121,10 +121,10 @@ unsigned int blk_mq_get_tag(struct
> blk_mq_alloc_data *data)
> WARN_ON_ONCE(1);
> return BLK_MQ_TAG_FAIL;
> }
> - bt = &tags->breserved_tags;
> + bt = tags->breserved_tags;
> tag_offset = 0;
> } else {
> - bt = &tags->bitmap_tags;
> + bt = tags->bitmap_tags;
> tag_offset = tags->nr_reserved_tags;
> }
>
>
> So current code gets bt pointer by simply offsetting a certain distance
> from tags pointer - that is the add I mention.
>
> With the change in this patch, we need to load memory at address
> &tags->bitmap_tags to get bt - this is the load I mention.
>
> So for this:
>
> if (tags->ptr == &tags->__default)
>
> We load &tags->ptr to get the pointer value for comparison vs
> &tags->__default.
>
> There must be something I'm missing...
>
The point here was that the load might refer to _other_ memory locations
(as it's being allocated separately), thus incurring a cache miss.
With embedded tag bitmaps we'll load from the same cache line
(hopefully), and won't get a performance hit.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2019-11-27 16:53 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 9:14 [PATCH RFC v3 0/8] blk-mq/scsi: Provide hostwide shared tags for SCSI HBAs Hannes Reinecke
2019-11-26 9:14 ` [PATCH 1/8] blk-mq: Remove some unused function arguments Hannes Reinecke
2019-11-26 9:14 ` [PATCH 2/8] blk-mq: rename BLK_MQ_F_TAG_SHARED as BLK_MQ_F_TAG_QUEUE_SHARED Hannes Reinecke
2019-11-26 9:14 ` [PATCH 3/8] blk-mq: Use a pointer for sbitmap Hannes Reinecke
2019-11-26 15:14 ` Jens Axboe
2019-11-26 16:54 ` John Garry
2019-11-26 17:11 ` Jens Axboe
2019-11-26 17:23 ` John Garry
2019-11-26 17:25 ` Jens Axboe
2019-11-26 18:08 ` John Garry
2019-11-27 1:46 ` Jens Axboe
2019-11-27 13:05 ` John Garry
2019-11-27 13:12 ` Hannes Reinecke
2019-11-27 14:20 ` Jens Axboe
2019-11-27 14:21 ` Jens Axboe
2019-11-27 14:44 ` John Garry
2019-11-27 16:52 ` Hannes Reinecke [this message]
2019-11-27 18:02 ` John Garry
2019-11-26 9:14 ` [PATCH 4/8] blk-mq: Facilitate a shared sbitmap per tagset Hannes Reinecke
2019-11-26 11:05 ` Ming Lei
2019-11-26 11:27 ` Hannes Reinecke
2019-11-26 11:50 ` John Garry
2019-11-26 15:54 ` Ming Lei
2019-11-27 17:02 ` Hannes Reinecke
2019-11-29 0:25 ` Ming Lei
2019-11-29 9:21 ` John Garry
2019-11-26 9:14 ` [PATCH 5/8] scsi: Add template flag 'host_tagset' Hannes Reinecke
2019-11-26 9:14 ` [PATCH 6/8] scsi: hisi_sas: Switch v3 hw to MQ Hannes Reinecke
2019-11-26 9:14 ` [PATCH 7/8] smartpqi: enable host tagset Hannes Reinecke
2019-11-26 9:14 ` [PATCH 8/8] hpsa: switch to using blk-mq Hannes Reinecke
2019-11-26 10:09 ` [PATCH RFC v3 0/8] blk-mq/scsi: Provide hostwide shared tags for SCSI HBAs John Garry
2019-11-26 13:10 [PATCH RFC v4 " Hannes Reinecke
2019-11-26 13:10 ` [PATCH 3/8] blk-mq: Use a pointer for sbitmap Hannes Reinecke
2019-11-26 16:42 ` Christoph Hellwig
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=58875c2b-5141-b8be-a086-4fa29137d1e6@suse.de \
--to=hare@suse.de \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=john.garry@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.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;
as well as URLs for NNTP newsgroup(s).