From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752729AbdJMRcw (ORCPT ); Fri, 13 Oct 2017 13:32:52 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:52789 "EHLO mail-it0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138AbdJMRct (ORCPT ); Fri, 13 Oct 2017 13:32:49 -0400 X-Google-Smtp-Source: ABhQp+T4tF0MsSU9PvFPf4pNFbqyy84+8HLREEdUCWFWohaNYwDisBZhLVtGUInaFJYT8qip2WYaXQ== Subject: Re: [PATCH V8 4/7] blk-mq: introduce .get_budget and .put_budget in blk_mq_ops To: Ming Lei , linux-block@vger.kernel.org, Christoph Hellwig Cc: Bart Van Assche , Laurence Oberman , Paolo Valente , Oleksandr Natalenko , Tom Nguyen , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Omar Sandoval , John Garry References: <20171013172459.1376-1-ming.lei@redhat.com> <20171013172459.1376-5-ming.lei@redhat.com> From: Jens Axboe Message-ID: Date: Fri, 13 Oct 2017 11:32:41 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171013172459.1376-5-ming.lei@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/2017 11:24 AM, Ming Lei wrote: > For SCSI devices, there is often per-request-queue depth, which need > to be respected before queuing one request. > > The current blk-mq always dequeues request first, then calls .queue_rq() > to dispatch the request to lld. One obvious issue of this way is that I/O > merge may not be good, because when the per-request-queue depth can't be > respected, .queue_rq() has to return BLK_STS_RESOURCE, then this request > has to stay in hctx->dispatch list, and never got chance to participate > into I/O merge. > > This patch introduces .get_budget and .put_budget callback in blk_mq_ops, > then we can try to get reserved budget first before dequeuing request. > Once the budget for queueing I/O can't be satisfied, we don't need to > dequeue request at all, then I/O merge can get improved a lot. Still think this should be blk_mq_get_dispatch_budget(), like in the incremental I sent out. That way you actually know what it is doing, get_budget() could be anything. > @@ -2582,6 +2606,9 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) > if (!set->ops->queue_rq) > return -EINVAL; > > + if ((!!set->ops->get_budget) != (!!set->ops->put_budget)) > + return -EINVAL; if (!set->ops->get_budget ^ !set->ops->put_budget) is cleaner, imho. -- Jens Axboe