From patchwork Wed Jul 14 15:06:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 476766 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp659550jao; Wed, 14 Jul 2021 08:11:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAnUOmdMJpWB8AYHS373ZR0z71taRCA5HMYUQUmlNQsUH7oC9pPchT5Z0f1HBUoDJ7FTW/ X-Received: by 2002:a05:6402:2317:: with SMTP id l23mr14419455eda.265.1626275487226; Wed, 14 Jul 2021 08:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626275487; cv=none; d=google.com; s=arc-20160816; b=LHlp0Hh1aR3d+l/CfXpzrUO8LlZgLnoi4jjw0y4FntAZXMQNdVIr/a45bnrBBYEydV +95IPcl8eMnoJ1V7ySzZAXWn2zICuMBqi5/cQ1WTaSv4svWHD1nyvwh33cvaGfXyX2RJ 8eRUswLhApYLTKyDKfdVTY/dJKy3xC1h8H42fmfPQ6vbBFBMnme/58PgQn61AwGGgU5A ge/fUXYDP1iZqlnkx8rDlXJtogwL0d3To3wGpsOsdYK80+2tMKNzZk3lOwCBvN9ZWt0k YmQxzjC0DldBIYW6z8VG4o9R9mkLZzL2a10z4svOjMITTEmazAIXmSGOB4LrLJ7/CSrh rSJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=+tUoOR1kV3dZKMImoCUyG1bQbLLNo3kLKNr05BUQtQc=; b=s/PQW8l7vIOgAyj5OLug+iGgdJRD50L7mzAbnui3pgjLvYpZFgGB7aYm0WgxTLAuFg e+vHV2CtMKUhFgMMyo0GI9c22bZe5piDlnk+nwQxys2y0qwo94pwPDRcoQ+OPPYPmOSQ q33GpiQIo77Em0RzoG+p4Z05wI5prUFsNOsk1wdNsrtfs+/CtsG7HJFN/jzBlT7L1TqC hTWDxXR22USdT57wyYTjr6F2FNFD25O6R5OkS0S5/qSlvEA39yUjS9N++LmGQTB6tkrG m/e8GrvLOKESSdJrYlhwY3bRXcUmMRHFCSZhyyEwFyEuE+9fYVaH9xxcR4ePuUpx4ePq 8BnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si2999812edc.592.2021.07.14.08.11.27 for ; Wed, 14 Jul 2021 08:11:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239615AbhGNPOO (ORCPT ); Wed, 14 Jul 2021 11:14:14 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3406 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239605AbhGNPON (ORCPT ); Wed, 14 Jul 2021 11:14:13 -0400 Received: from fraeml701-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GQ0vm6HF0z6D97r; Wed, 14 Jul 2021 22:56:52 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml701-chm.china.huawei.com (10.206.15.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 14 Jul 2021 17:11:19 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 14 Jul 2021 16:11:17 +0100 From: John Garry To: CC: , , , , , , John Garry Subject: [PATCH 3/9] blk-mq: Relocate shared sbitmap resize in blk_mq_update_nr_requests() Date: Wed, 14 Jul 2021 23:06:29 +0800 Message-ID: <1626275195-215652-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1626275195-215652-1-git-send-email-john.garry@huawei.com> References: <1626275195-215652-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For shared sbitmap, if the call to blk_mq_tag_update_depth() was successful for any hctx when hctx->sched_tags is not set, then it would be successful for all (due to nature in which blk_mq_tag_update_depth() fails). As such, there is no need to call blk_mq_tag_resize_shared_sbitmap() for each hctx. So relocate the call until after the hctx iteration under the !q->elevator check, which is equivalent (to !hctx->sched_tags). Signed-off-by: John Garry --- block/blk-mq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.26.2 diff --git a/block/blk-mq.c b/block/blk-mq.c index ae28f470893c..56e3c6fdba60 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3624,8 +3624,6 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) if (!hctx->sched_tags) { ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr, false); - if (!ret && blk_mq_is_sbitmap_shared(set->flags)) - blk_mq_tag_resize_shared_sbitmap(set, nr); } else { ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags, nr, true); @@ -3643,9 +3641,14 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) } if (!ret) { q->nr_requests = nr; - if (q->elevator && blk_mq_is_sbitmap_shared(set->flags)) - sbitmap_queue_resize(&q->sched_bitmap_tags, - nr - set->reserved_tags); + if (blk_mq_is_sbitmap_shared(set->flags)) { + if (q->elevator) { + sbitmap_queue_resize(&q->sched_bitmap_tags, + nr - set->reserved_tags); + } else { + blk_mq_tag_resize_shared_sbitmap(set, nr); + } + } } blk_mq_unquiesce_queue(q);