From patchwork Mon Sep 13 15:12:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 509776 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp654949jao; Mon, 13 Sep 2021 08:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUY3t6hSD9zCtD5PQh7AbENx9rUDkzFvv0PAzp0csGnRJvQK6nGEzAVdf5EWZWj7akqCBL X-Received: by 2002:a17:906:7147:: with SMTP id z7mr11031966ejj.94.1631546266125; Mon, 13 Sep 2021 08:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631546266; cv=none; d=google.com; s=arc-20160816; b=FYiX2TKiJ287e/w/CVxctxyMhOPqb/YMCdzOFTdu6sPjwbK+Agbk7Mh9IF4gUbvJ7q rP8xBWbvfnKkbtrc3hLKJcCc7Lj+msVaYx4fIH+eifJ1VZRJpWnY8itYc1a9UVLPmKMS t5/FYQkETe2G3UuJILVUGM+q9NlbziFuNeTWZq9YV1zzjCSJ9vBWwhOIGfwLDMOdRqgg oNDPYgXGDuvBnu2Ypsz1VMtfI1eOEjkzDfpK5X7k2mnpBkrO9yiuIp9nx2cyeW+ESH89 5ECDlzROj3fNNtuayhZWCfTBNyW3xUQ7aNQnBpWmilcfw3fHPvIOc3M92pSMHWlam1wr Ubxw== 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=Y7a4MQU5fiMoTKKFr/PtgYvI9Ssnm7AeRu03RUWVdno=; b=osZVwCLr1tz1GmYxnz0lN6DaukVaTGPIp5wKVG0Ew73y7X7kRR6lt1619gypqS1AYV Ge4TSuLan+q544gqYcc+oaTVpF7WQoVA2/Srsuwy/IvZNL81tA16qu8ijEZZbqW0bX81 CrAUWnlUb+xeBwog7FXGHPmRFaJcRCo7CIt1Teq3NYD1IM3AQ/4kGMwed8p7DSUFF1H1 gWbLTAQlEsMvRbbI6yGWL3BCNZImO4HEOfVmvlZpQdTq9HaaDNGLveJQZ4HbDF0uZs5r nvuuarvjFfBpAuWxL+Um4BK6Qze9khjLeJsF/MKMuQPMCWG1OZe1urg6rXYCUeplF6m2 PxzQ== 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 18si7608876ejh.282.2021.09.13.08.17.45 for ; Mon, 13 Sep 2021 08:17:46 -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 S1347090AbhIMPS7 (ORCPT ); Mon, 13 Sep 2021 11:18:59 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3775 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345654AbhIMPSp (ORCPT ); Mon, 13 Sep 2021 11:18:45 -0400 Received: from fraeml742-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4H7VQq1spNz67M3Q; Mon, 13 Sep 2021 23:15:15 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml742-chm.china.huawei.com (10.206.15.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 13 Sep 2021 17:17:27 +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.2308.8; Mon, 13 Sep 2021 16:17:25 +0100 From: John Garry To: CC: , , , , John Garry Subject: [PATCH RESEND v3 03/13] blk-mq: Relocate shared sbitmap resize in blk_mq_update_nr_requests() Date: Mon, 13 Sep 2021 23:12:20 +0800 Message-ID: <1631545950-56586-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1631545950-56586-1-git-send-email-john.garry@huawei.com> References: <1631545950-56586-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 Reviewed-by: Ming Lei --- block/blk-mq.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.26.2 Reviewed-by: Hannes Reinecke diff --git a/block/blk-mq.c b/block/blk-mq.c index 2316ff27c1f5..1a4bb2db30e5 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3616,8 +3616,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); @@ -3635,9 +3633,13 @@ 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);