Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1276908pxb; Thu, 15 Apr 2021 19:52:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9i4bb3w6x9CTk9GELlcbNk+wZdVHHdFvnkePgOSP2PJmn6XYk2e9pKY0kyRTDoP7IOQFf X-Received: by 2002:a17:902:ce85:b029:eb:46e1:2da2 with SMTP id f5-20020a170902ce85b02900eb46e12da2mr7235080plg.38.1618541557411; Thu, 15 Apr 2021 19:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618541557; cv=none; d=google.com; s=arc-20160816; b=lR6dB5Gj4CSaOrnbdxX1FwOUfxvihbzYFrbUhHwMpO1uYVcIhphcsY+4pxIOGx46Um Yt9RC7wEIw2C6zILKeQbK2vxFJRQAvy/d3k9pscFrGQ1ArZexE+WJBqSGdVeL03ET5iu XMYGQ+Jc9L7VTNxnplD55qwwyViivyf8CxRSwTockZO8AC9jqrPZbRB9zYvO+fdKmmEn hi8sVvGiult5ddcCozyNaptWRjNwIonrGFiT1q2gIACXBq6lgdOTY5//FHgqX0xwjDFQ Hjsxs+VExx4W7cNGH4cRJ9DPmvhziMPBK8nb5xoyygWGc61AbYuw0FGZu58muhI29jhR nzkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mlRPn97nJzfL/YSQqBED+cxJcSwhch861xmnBFyG2xw=; b=JYZfuLbJAs4W0gIA2p0iptWuBj5r4FP5f40i5SAHdZaEPMetHxZIQrzX8QTB7ump3D 6aB5vR7M1+wc4/wVn1iJ0362PLzb6eEF4Yeu1TZ461KF7mitNYTGkwC15enWueyJbMM2 jaCm5KWrho7cBbX+2urXNsPasFIpADVBBSSy4mqWQizghONifi5WEFW/Pq0rR4iJpbm8 VwMtlDsNin+XLm899og/fc/8LY1PI8gam5BiYvAkoz4epFLYpanU6OQDidJm+bSMe3VG w3bdPbmGTCsKkp+eXHt63PKoiHMOcXqcjzPJmj+EuZd17qAIsjOP7VlNLb0xq0NPwRLn YuOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZO+thkXB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si5157068pge.442.2021.04.15.19.52.24; Thu, 15 Apr 2021 19:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZO+thkXB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236094AbhDPCKw (ORCPT + 99 others); Thu, 15 Apr 2021 22:10:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31725 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235058AbhDPCKw (ORCPT ); Thu, 15 Apr 2021 22:10:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618539027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mlRPn97nJzfL/YSQqBED+cxJcSwhch861xmnBFyG2xw=; b=ZO+thkXBK8x1pWms5oK5ZPcZ6pkUnmzn3vnha2bnpYPuDVmyWejmudoclMDY4RAOYACz0e aYh8CHcQOoU0wOnb8SYIdeNkcYLkOmgsM7IyxkNN1AHfwcc4LEysbq9zadc1F7tjf5W9sX BrYty02Zo9MOKu6TzBJnmnxCpIk131c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-JwJVUmrsMj6vRwQM4pEi8w-1; Thu, 15 Apr 2021 22:10:25 -0400 X-MC-Unique: JwJVUmrsMj6vRwQM4pEi8w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 533CC107ACED; Fri, 16 Apr 2021 02:10:22 +0000 (UTC) Received: from T590 (ovpn-12-36.pek2.redhat.com [10.72.12.36]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4586C62677; Fri, 16 Apr 2021 02:10:19 +0000 (UTC) Date: Fri, 16 Apr 2021 10:10:15 +0800 From: Ming Lei To: Lin Feng Cc: axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] blk-mq: bypass IO scheduler's limit_depth for passthrough request Message-ID: References: <20210415033920.213963-1-linf@wangsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210415033920.213963-1-linf@wangsu.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 15, 2021 at 11:39:20AM +0800, Lin Feng wrote: > Commit 01e99aeca39796003 ("blk-mq: insert passthrough request into > hctx->dispatch directly") gives high priority to passthrough requests and > bypass underlying IO scheduler. But as we allocate tag for such request it > still runs io-scheduler's callback limit_depth, while we really want is to > give full sbitmap-depth capabity to such request for acquiring available > tag. > blktrace shows PC requests(dmraid -s -c -i) hit bfq's limit_depth: > 8,0 2 0 0.000000000 39952 1,0 m N bfq [bfq_limit_depth] wr_busy 0 sync 0 depth 8 > 8,0 2 1 0.000008134 39952 D R 4 [dmraid] > 8,0 2 2 0.000021538 24 C R [0] > 8,0 2 0 0.000035442 39952 1,0 m N bfq [bfq_limit_depth] wr_busy 0 sync 0 depth 8 > 8,0 2 3 0.000038813 39952 D R 24 [dmraid] > 8,0 2 4 0.000044356 24 C R [0] > > This patch introduce a new wrapper to make code not that ugly. > > Signed-off-by: Lin Feng > --- > block/blk-mq.c | 3 ++- > include/linux/blkdev.h | 6 ++++++ > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index d4d7c1caa439..927189a55575 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -361,11 +361,12 @@ static struct request *__blk_mq_alloc_request(struct blk_mq_alloc_data *data) > > if (e) { > /* > - * Flush requests are special and go directly to the > + * Flush/passthrough requests are special and go directly to the > * dispatch list. Don't include reserved tags in the > * limiting, as it isn't useful. > */ > if (!op_is_flush(data->cmd_flags) && > + !blk_op_is_passthrough(data->cmd_flags) && > e->type->ops.limit_depth && > !(data->flags & BLK_MQ_REQ_RESERVED)) > e->type->ops.limit_depth(data->cmd_flags, data); > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index 158aefae1030..0d81eed39833 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -272,6 +272,12 @@ static inline bool bio_is_passthrough(struct bio *bio) > return blk_op_is_scsi(op) || blk_op_is_private(op); > } > > +static inline bool blk_op_is_passthrough(unsigned int op) > +{ > + return (blk_op_is_scsi(op & REQ_OP_MASK) || > + blk_op_is_private(op & REQ_OP_MASK)); > +} > + > static inline unsigned short req_get_ioprio(struct request *req) > { > return req->ioprio; > -- > 2.30.2 > Looks fine: Reviewed-by: Ming Lei Thanks, Ming