Linux block layer
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.de>,
	"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: Tue, 26 Nov 2019 16:54:36 +0000	[thread overview]
Message-ID: <62838bca-cd3c-fccf-767c-76d8bea12324@huawei.com> (raw)
In-Reply-To: <8f0522ee-2a81-c2ae-d111-3ff89ee6f93e@kernel.dk>

On 26/11/2019 15:14, Jens Axboe wrote:
> On 11/26/19 2:14 AM, Hannes Reinecke wrote:
>> Instead of allocating the tag bitmap in place we should be using a
>> pointer. This is in preparation for shared host-wide bitmaps.
> 
> Not a huge fan of this, it's an extra indirection in the hot path
> of both submission and completion.

Hi Jens,

Thanks for having a look.

I checked the disassembly for blk_mq_get_tag() as a sample - which I 
assume is one hot path function which you care about - and the cost of 
the indirection is a load instruction instead of an add, denoted by ***, 
below:

Before:
static inline struct blk_mq_tags *blk_mq_tags_from_data(struct 
blk_mq_alloc_data *data)
{
	if (data->flags & BLK_MQ_REQ_INTERNAL)
		return data->hctx->sched_tags;
      6ac:	a9554c64 	ldp	x4, x19, [x3, #336]

	return data->hctx->tags;
      6b0:	f27e003f 	tst	x1, #0x4
      6b4:	f9003ba0 	str	x0, [x29, #112]
      6b8:	a9078ba2 	stp	x2, x2, [x29, #120]
      6bc:	9a841273 	csel	x19, x19, x4, ne  // ne = any
	if (data->flags & BLK_MQ_REQ_RESERVED) {
      6c0:	36081021 	tbz	w1, #1, 8c4 <blk_mq_get_tag+0x264>
		if (unlikely(!tags->nr_reserved_tags)) {
      6c4:	b9400660 	ldr	w0, [x19, #4]

      6d4:	f90027ba 	str	x26, [x29, #72]
		tag_offset = 0;
      6c8:	52800018 	mov	w24, #0x0                   	// #0
		bt = &tags->breserved_tags;
      6cc:	91014273 	add	x19, x19, #0x50 ***
		if (unlikely(!tags->nr_reserved_tags)) {
      6d0:	340012e0 	cbz	w0, 92c <blk_mq_get_tag+0x2cc>
	tag = __blk_mq_get_tag(data, bt);
      6d8:	aa1303e1 	mov	x1, x19
      6dc:	aa1403e0 	mov	x0, x20
      6e0:	97fffe92 	bl	128 <__blk_mq_get_tag>

After:
static inline struct blk_mq_tags *blk_mq_tags_from_data(struct 
blk_mq_alloc_data *data)
{
	if (data->flags & BLK_MQ_REQ_INTERNAL)
		return data->hctx->sched_tags;

      6b4:	a9550004 	ldp	x4, x0, [x0, #336]

	return data->hctx->tags;
      6ac:	f27e005f 	tst	x2, #0x4
      6b0:	f9003ba1 	str	x1, [x29, #112]
		return data->hctx->sched_tags;
      6b8:	a9078fa3 	stp	x3, x3, [x29, #120]
	return data->hctx->tags;
      6bc:	9a841000 	csel	x0, x0, x4, ne  // ne = any
	if (data->flags & BLK_MQ_REQ_RESERVED) {
      6c0:	36080fa2 	tbz	w2, #1, 8b4 <blk_mq_get_tag+0x254>
		if (unlikely(!tags->nr_reserved_tags)) {
      6c4:	b9400401 	ldr	w1, [x0, #4]
      6cc:	f90027ba 	str	x26, [x29, #72]
		tag_offset = 0;
      6d0:	52800017 	mov	w23, #0x0                   	// #0
		bt = tags->breserved_tags;

      6c8:	340012a1 	cbz	w1, 91c <blk_mq_get_tag+0x2bc>
      6d4:	f9400c14 	ldr	x20, [x0, #24] ***
	tag = __blk_mq_get_tag(data, bt);
      6d8:	aa1303e0 	mov	x0, x19
      6dc:	aa1403e1 	mov	x1, x20
      6e0:	97fffe92 	bl	128 <__blk_mq_get_tag>

This is arm64 dis.

I'm just saying this to provide some illustration of the potential 
performance impact of this change.

Thanks,
John


  reply	other threads:[~2019-11-26 16:54 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 [this message]
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
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
  -- strict thread matches above, loose matches on Subject: below --
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=62838bca-cd3c-fccf-767c-76d8bea12324@huawei.com \
    --to=john.garry@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.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