From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EE13C433F5 for ; Sat, 4 Dec 2021 20:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To: Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s/GPDl5dRrWA47RNMSHEzffScc5qkUhcV7AvYge1sPc=; b=nxcXiTKqJPlknpgXt3UWy+3iA0 pRvnah2EJIVZUvU/SFBmOBKmtqqA5msUIZEiFtrZ/kZ5Q2MTrKgP9kIljr9J5rbST38Zdy26+3hO5 q9Y3rgs9fq1Z6t/gVUVvFk2IEbbIyqkTWruKvLqtEocbkc+u5QPEqMvlQzivK3dc9hDJ1Ixg7e5k0 F3FA/oCrD1YU2X99a92lBWT9Esiforh4uhK0uYVYf8NB99aMZDbJL/xA8w0W5Pm6m4QLkZe8B9Br+ lo9EzenSZ+OkvqYkUO/ns5CLX9xy4qt/IyIW5haDxkHhjx5hMg3zUoh1TSEfPpHGlFWjN+ijSE3Mr 4wa01e3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtbPT-000l4A-UC; Sat, 04 Dec 2021 20:13:27 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtbPL-000l3Y-G5 for linux-nvme@lists.infradead.org; Sat, 04 Dec 2021 20:13:21 +0000 Received: by mail-io1-xd2c.google.com with SMTP id p23so8150986iod.7 for ; Sat, 04 Dec 2021 12:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=s/GPDl5dRrWA47RNMSHEzffScc5qkUhcV7AvYge1sPc=; b=G3FxP8oiFM+JTo6Qa55u922+wSekzBkJ64YQ2t/l9vHROcVSBw+b6djj3goI49cUyq u1Q01cmWtv2Zmc7yZiQ8sq+Dq1alLnFYlwiLiJSSBoJAHKmmfWEIz/b6bBBAoLtEuFAr zQnx9Wgh8/2n7SL4nQjpvMIWu5U9Wjb//17qyZaMVLyhLD6FetQjLOQ2ssWm/bTDPDA6 CQ6XkU3GtSFmq290A5iJ0jDWEXOnVEV9qikutXxzHlXSqMwO6S9PmYEU8sti4ej0Wp+I fvcZOI0OMwjwKF7q6TRsuiE732+obg8SBixAW3Yp1us+dCf606YwARLhhi5soDphXM+S 5wKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=s/GPDl5dRrWA47RNMSHEzffScc5qkUhcV7AvYge1sPc=; b=qBbH3M2gEenR657BKGqAvLQSOll4+g8bV0PvbmNsBPmfaxKG5b9lohSgJJmy9XIHXL JJT0NUQyoWfnOu53I8MhHFWlz4Lnh/DOjyrJCPgrRkT5eOBAYwEtqJ3T0pglqzpHtJgo 4Rku1+a0PbOXqZAOn6YlxhkeAeYcp9AN9YPse0fHgVWABWHjbTbk3XLMUFDPWkNrucXR 1Ur/TnFQf37cZyB7+cYNLsHHJIxhGsKyNObvitw85u3v8VmckcNlK8GaRkWv7/Q67CIq vzoMlH6J/cixBw4FlIAQQcgI+v4/m5ArKiRu4dShJLZRC25jlrYpJMQS2O3NfcuD/9bN n9qg== X-Gm-Message-State: AOAM531QqKpWkGZCmHJDaBtoMHtdUW4ngGEe3zyXV7snBqnIJKGeaBSd wFz+Zo4wGRbIgckEVcDmPYtsi8xIB9dvF677 X-Google-Smtp-Source: ABdhPJyGEZq9vp3aRUXDEfeq4qqWnFtEipW97YjBkLTA4PqZxz+D/nAsbDcOAfjOyC8tBxebnh5hcQ== X-Received: by 2002:a6b:8d12:: with SMTP id p18mr27141290iod.145.1638648795800; Sat, 04 Dec 2021 12:13:15 -0800 (PST) Received: from [192.168.1.116] ([66.219.217.159]) by smtp.gmail.com with ESMTPSA id r18sm3531328ilh.59.2021.12.04.12.13.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Dec 2021 12:13:15 -0800 (PST) Subject: Re: [PATCH 1/4] block: add mq_ops->queue_rqs hook To: Hannes Reinecke , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org References: <20211203214544.343460-1-axboe@kernel.dk> <20211203214544.343460-2-axboe@kernel.dk> <2a3fb650-4b6e-9eb1-aa6b-318236717ccf@suse.de> From: Jens Axboe Message-ID: Date: Sat, 4 Dec 2021 13:13:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <2a3fb650-4b6e-9eb1-aa6b-318236717ccf@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211204_121319_577006_1EC6EF54 X-CRM114-Status: GOOD ( 25.41 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On 12/4/21 3:43 AM, Hannes Reinecke wrote: > On 12/3/21 10:45 PM, Jens Axboe wrote: >> If we have a list of requests in our plug list, send it to the driver in >> one go, if possible. The driver must set mq_ops->queue_rqs() to support >> this, if not the usual one-by-one path is used. >> >> Signed-off-by: Jens Axboe >> --- >> block/blk-mq.c | 24 +++++++++++++++++++++--- >> include/linux/blk-mq.h | 8 ++++++++ >> 2 files changed, 29 insertions(+), 3 deletions(-) >> >> diff --git a/block/blk-mq.c b/block/blk-mq.c >> index 22ec21aa0c22..9ac9174a2ba4 100644 >> --- a/block/blk-mq.c >> +++ b/block/blk-mq.c >> @@ -2513,6 +2513,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule) >> { >> struct blk_mq_hw_ctx *this_hctx; >> struct blk_mq_ctx *this_ctx; >> + struct request *rq; >> unsigned int depth; >> LIST_HEAD(list); >> >> @@ -2521,7 +2522,26 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule) >> plug->rq_count = 0; >> >> if (!plug->multiple_queues && !plug->has_elevator && !from_schedule) { >> - blk_mq_run_dispatch_ops(plug->mq_list->q, >> + struct request_queue *q; >> + >> + rq = plug->mq_list; >> + q = rq->q; >> + >> + /* >> + * Peek first request and see if we have a ->queue_rqs() hook. >> + * If we do, we can dispatch the whole plug list in one go. We >> + * already know at this point that all requests belong to the >> + * same queue, caller must ensure that's the case. >> + */ >> + if (q->mq_ops->queue_rqs && >> + !(rq->mq_hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)) { > > What is the dependency on shared tags here? > From what I've seen it's just about submitting requests; the only > difference to shared tags is the way the tags are allocated. > Care to explain? For shared tags, we need to actively increment the use count per request. This path doesn't do that, so it's disabled for now. It could be done, but then it'd have to be in the caller, so I'd rather leave it for a future optimization if anyone cares enough about this for shared tags. I can add a comment about it if that helps. -- Jens Axboe