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


Groups > linux.kernel > #1637450

Re: Large latency on blk_queue_enter

From Javier González <jg@lightnvm.io>
Newsgroups linux.kernel
Subject Re: Large latency on blk_queue_enter
Date 2017-05-08 15:50 +0200
Message-ID <tERd0-4yE-13@gated-at.bofh.it> (permalink)
References <tEPuy-3tj-21@gated-at.bofh.it> <tEPXz-3RJ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

> On 8 May 2017, at 14.27, Ming Lei <ming.lei@redhat.com> wrote:
> 
> On Mon, May 08, 2017 at 01:54:58PM +0200, Javier González wrote:
>> Hi,
>> 
>> I find an unusual added latency(~20-30ms) on blk_queue_enter when
>> allocating a request directly from the NVMe driver through
>> nvme_alloc_request. I could use some help confirming that this is a bug
>> and not an expected side effect due to something else.
>> 
>> I can reproduce this latency consistently on LightNVM when mixing I/O
>> from pblk and I/O sent through an ioctl using liblightnvm, but I don't
>> see anything on the LightNVM side that could impact the request
>> allocation.
>> 
>> When I have a 100% read workload sent from pblk, the max. latency is
>> constant throughout several runs at ~80us (which is normal for the media
>> we are using at bs=4k, qd=1). All pblk I/Os reach the nvme_nvm_submit_io
>> function on lightnvm.c., which uses nvme_alloc_request. When we send a
>> command from user space through an ioctl, then the max latency goes up
>> to ~20-30ms. This happens independently from the actual command
>> (IN/OUT). I tracked down the added latency down to the call
>> percpu_ref_tryget_live in blk_queue_enter. Seems that the queue
>> reference counter is not released as it should through blk_queue_exit in
>> blk_mq_alloc_request. For reference, all ioctl I/Os reach the
>> nvme_nvm_submit_user_cmd on lightnvm.c
>> 
>> Do you have any idea about why this might happen? I can dig more into
>> it, but first I wanted to make sure that I am not missing any obvious
>> assumption, which would explain the reference counter to be held for a
>> longer time.
> 
> You need to check if the .q_usage_counter is working at atomic mode.
> This counter is initialized as atomic mode, and finally switchs to
> percpu mode via percpu_ref_switch_to_percpu() in blk_register_queue().

Thanks for commenting Ming.

The .q_usage_counter is not working on atomic mode. The queue is
initialized normally through blk_register_queue() and the counter is
switched to percpu mode, as you mentioned. As I understand it, this is
how it should be, right?

Thanks,
Javier

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 14:00 +0200
  Re: Large latency on blk_queue_enter Ming Lei <ming.lei@redhat.com> - 2017-05-08 14:30 +0200
    Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 15:50 +0200
      Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 16:30 +0200
        Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 16:50 +0200
          Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 17:10 +0200
            Re: Large latency on blk_queue_enter Jens Axboe <axboe@kernel.dk> - 2017-05-08 17:20 +0200
              Re: Large latency on blk_queue_enter Jens Axboe <axboe@kernel.dk> - 2017-05-08 17:30 +0200
                Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 17:40 +0200
                Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 17:50 +0200
                Re: Large latency on blk_queue_enter Jens Axboe <axboe@kernel.dk> - 2017-05-08 18:10 +0200
                Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 18:40 +0200
                Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-09 12:40 +0200
                Re: Large latency on blk_queue_enter Ming Lei <ming.lei@redhat.com> - 2017-05-09 13:00 +0200
                Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-09 13:30 +0200
                Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-09 16:30 +0200
                Re: Large latency on blk_queue_enter Jens Axboe <axboe@kernel.dk> - 2017-05-08 17:50 +0200
              Re: Large latency on blk_queue_enter Javier González <jg@lightnvm.io> - 2017-05-08 17:30 +0200

csiph-web