Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278062 > unrolled thread

QUEUE_FLAG_NO_SG_MERGE and non-block-mq

Started byHannes Reinecke <hare@suse.de>
First post2015-11-26 09:20 +0100
Last post2015-11-27 17:20 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  QUEUE_FLAG_NO_SG_MERGE and non-block-mq Hannes Reinecke <hare@suse.de> - 2015-11-26 09:20 +0100
    Re: QUEUE_FLAG_NO_SG_MERGE and non-block-mq Ming Lei <ming.lei@canonical.com> - 2015-11-26 10:30 +0100
      Re: QUEUE_FLAG_NO_SG_MERGE and non-block-mq Hannes Reinecke <hare@suse.de> - 2015-11-27 15:40 +0100
        Re: QUEUE_FLAG_NO_SG_MERGE and non-block-mq Jens Axboe <axboe@fb.com> - 2015-11-27 17:20 +0100

#1278062 — QUEUE_FLAG_NO_SG_MERGE and non-block-mq

FromHannes Reinecke <hare@suse.de>
Date2015-11-26 09:20 +0100
SubjectQUEUE_FLAG_NO_SG_MERGE and non-block-mq
Message-ID<qyZWy-2oi-33@gated-at.bofh.it>
Hi all,

while investigating the crash in scsi_lib.c I found a rather curious
behaviour for QUEUE_FLAG_NO_SG_MERGE.

While the flag is evaluated in blk_recalc_rq_segments and
blk_recount_segments (resulting in nr_phys_segments being
computed based on that flag) it is completely ignored
during blk_rq_map_sg() or the actual merging itself.

This typically shouldn't be an issue, seeing that with
QUEUE_FLAG_NO_SG_MERGE nr_phys_segments will always be
larger than the actual segment count.

However, it still makes me wonder:
What is the point of having a QUEUE_FLAG_NO_SG_MERGE
which doesn't work as advertised?
Or, to be precise, which only works for blk-mq?
Should we make it work for non-block-mq, too?


Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1278107

FromMing Lei <ming.lei@canonical.com>
Date2015-11-26 10:30 +0100
Message-ID<qz12h-3e6-1@gated-at.bofh.it>
In reply to#1278062
On Thu, Nov 26, 2015 at 4:13 PM, Hannes Reinecke <hare@suse.de> wrote:
> Hi all,
>
> while investigating the crash in scsi_lib.c I found a rather curious
> behaviour for QUEUE_FLAG_NO_SG_MERGE.
>
> While the flag is evaluated in blk_recalc_rq_segments and
> blk_recount_segments (resulting in nr_phys_segments being
> computed based on that flag) it is completely ignored
> during blk_rq_map_sg() or the actual merging itself.

Yes, I guess Jens introduced the flag for decreasing CPU
consumption when comuputing segments, but it is still
ignored by blk_rq_map_sg(), but it may not be used
by some drivers.

After bio splitting is introduced, the flag is also ignored
when computing segments.

>
> This typically shouldn't be an issue, seeing that with
> QUEUE_FLAG_NO_SG_MERGE nr_phys_segments will always be
> larger than the actual segment count.
>
> However, it still makes me wonder:
> What is the point of having a QUEUE_FLAG_NO_SG_MERGE
> which doesn't work as advertised?
> Or, to be precise, which only works for blk-mq?
> Should we make it work for non-block-mq, too?

Thanks bio splitting, this flag has little effect on performance now,
so I think it can be removed if Jens has no objection.

Thanks,

>
>
> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke                            zSeries & Storage
> hare@suse.de                                   +49 911 74053 688
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
> HRB 21284 (AG Nürnberg)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1278828

FromHannes Reinecke <hare@suse.de>
Date2015-11-27 15:40 +0100
Message-ID<qzslP-471-1@gated-at.bofh.it>
In reply to#1278107
On 11/26/2015 10:21 AM, Ming Lei wrote:
> On Thu, Nov 26, 2015 at 4:13 PM, Hannes Reinecke <hare@suse.de> wrote:
>> Hi all,
>>
>> while investigating the crash in scsi_lib.c I found a rather curious
>> behaviour for QUEUE_FLAG_NO_SG_MERGE.
>>
>> While the flag is evaluated in blk_recalc_rq_segments and
>> blk_recount_segments (resulting in nr_phys_segments being
>> computed based on that flag) it is completely ignored
>> during blk_rq_map_sg() or the actual merging itself.
> 
> Yes, I guess Jens introduced the flag for decreasing CPU
> consumption when comuputing segments, but it is still
> ignored by blk_rq_map_sg(), but it may not be used
> by some drivers.
> 
> After bio splitting is introduced, the flag is also ignored
> when computing segments.
> 
>>
>> This typically shouldn't be an issue, seeing that with
>> QUEUE_FLAG_NO_SG_MERGE nr_phys_segments will always be
>> larger than the actual segment count.
>>
>> However, it still makes me wonder:
>> What is the point of having a QUEUE_FLAG_NO_SG_MERGE
>> which doesn't work as advertised?
>> Or, to be precise, which only works for blk-mq?
>> Should we make it work for non-block-mq, too?
> 
> Thanks bio splitting, this flag has little effect on performance now,
> so I think it can be removed if Jens has no objection.
> 
As per your suggestion we've made some performance measurements,
and 4k fio showed little if no impact:

NO_SG_MERGE:
  IOPS R/W: 148097.7+-125.7 / 148124.1+-123.1
  BW   R/W: 592392.4+-502.7 / 592498.3+-492.3
SG_MERGE:
  IOPS R/W: 148054.4+-123.3 / 148082.6+-120.0
  BW   R/W: 592219.2+-493.5 / 592332.3+-479.7

So the performance benefit lies squarely within the
error margin, making me wonder if it's worth bothering
with having the NO_SG_MERGE flag at all.

Thanks to Johannes for doing the measurements :-)

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1278871

FromJens Axboe <axboe@fb.com>
Date2015-11-27 17:20 +0100
Message-ID<qztUB-5dg-5@gated-at.bofh.it>
In reply to#1278828
On 11/27/2015 07:29 AM, Hannes Reinecke wrote:
> On 11/26/2015 10:21 AM, Ming Lei wrote:
>> On Thu, Nov 26, 2015 at 4:13 PM, Hannes Reinecke <hare@suse.de> wrote:
>>> Hi all,
>>>
>>> while investigating the crash in scsi_lib.c I found a rather curious
>>> behaviour for QUEUE_FLAG_NO_SG_MERGE.
>>>
>>> While the flag is evaluated in blk_recalc_rq_segments and
>>> blk_recount_segments (resulting in nr_phys_segments being
>>> computed based on that flag) it is completely ignored
>>> during blk_rq_map_sg() or the actual merging itself.
>>
>> Yes, I guess Jens introduced the flag for decreasing CPU
>> consumption when comuputing segments, but it is still
>> ignored by blk_rq_map_sg(), but it may not be used
>> by some drivers.
>>
>> After bio splitting is introduced, the flag is also ignored
>> when computing segments.
>>
>>>
>>> This typically shouldn't be an issue, seeing that with
>>> QUEUE_FLAG_NO_SG_MERGE nr_phys_segments will always be
>>> larger than the actual segment count.
>>>
>>> However, it still makes me wonder:
>>> What is the point of having a QUEUE_FLAG_NO_SG_MERGE
>>> which doesn't work as advertised?
>>> Or, to be precise, which only works for blk-mq?
>>> Should we make it work for non-block-mq, too?
>>
>> Thanks bio splitting, this flag has little effect on performance now,
>> so I think it can be removed if Jens has no objection.
>>
> As per your suggestion we've made some performance measurements,
> and 4k fio showed little if no impact:
>
> NO_SG_MERGE:
>    IOPS R/W: 148097.7+-125.7 / 148124.1+-123.1
>    BW   R/W: 592392.4+-502.7 / 592498.3+-492.3
> SG_MERGE:
>    IOPS R/W: 148054.4+-123.3 / 148082.6+-120.0
>    BW   R/W: 592219.2+-493.5 / 592332.3+-479.7
>
> So the performance benefit lies squarely within the
> error margin, making me wonder if it's worth bothering
> with having the NO_SG_MERGE flag at all.
>
> Thanks to Johannes for doing the measurements :-)

150K iops is on the slow side, though. It's pointless to iterate the sg 
list if we don't have to. I can try and run a few tests next week.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web