From patchwork Mon Aug 9 14:29:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 493870 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp2977180jap; Mon, 9 Aug 2021 07:38:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpCs52QPthDDwPN9vJBVd05P7SlXvpfUcDloU+AKAKjFRc+lGgilQhf62Hp1268hfFxnCl X-Received: by 2002:a02:958e:: with SMTP id b14mr23106156jai.123.1628519884093; Mon, 09 Aug 2021 07:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628519884; cv=none; d=google.com; s=arc-20160816; b=K8SMxPBBaWsY9K2GmdaVo0qzq6F9B6n0Hn0aWaCFJ9uETFmGynxub105QiDjEN5HrZ w0g0iU+JeO/9fS7eyQHrzfJqeYQRRhQdKs/JxVIlC2PO4P/VGINhhhFWBuNmaZrQS3Ka 0F2jx9gU6hbSMA29WPWhNGQkXwdezN3hRbKAWaQQTHhWN3fqrYbGIyhn247dqcjcNabR vS1xzUkBi/5fNejINT6CM6/cz4bDF7UsyREXf2y+yQJ6TCtZjKh/BY6S58ehJGPvTq4R H2xiyPdM+/Le0XR96R8G1ZhGgxv+WmbZ4qw5VJRKmp2tTe1rziSyVSRC1/9DTlf6U/O/ 5PSg== 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=NJq2wa0nCqrJ/qUdgE067Voi/ejlrTHzxs3ZWP60rwQ=; b=0nubh7WjJyScRUhfDRHFgP0uO/szWY1uWlQXvfmuAF8vACiCnc/2rBT+oKucFW3k5Q D010xFoJlwYgalNBkju/KjPHaaCvrEzAzONF04aPYX64PmJlc2uazaitfIijEv1Q9MW8 4tPyrMHE3Eiorm6T7EylDTfDNlQ2xMKfA1srasHaBCFLJ8AeuyLz9BbRNWkSHeU+++Ce DJGwAOn5xJ0UlPC5XBoRg4E8glLIaNQSA6429NvgSTDDVqRThrEK1pAahm2VHLVUuPnC rYXRxnH7aXtlb+MIXpqXiPaj/Eey+Ulqf5kA9vHUwgASe6i/PI7t3+y5PwLU1ENvo3jO N95A== 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 r17si21191782iov.104.2021.08.09.07.38.04 for ; Mon, 09 Aug 2021 07:38:04 -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 S235230AbhHIOgy (ORCPT ); Mon, 9 Aug 2021 10:36:54 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3609 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235256AbhHIOfA (ORCPT ); Mon, 9 Aug 2021 10:35:00 -0400 Received: from fraeml734-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Gjz9V4HLYz6D9Hg; Mon, 9 Aug 2021 22:34:06 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml734-chm.china.huawei.com (10.206.15.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 9 Aug 2021 16:34:33 +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; Mon, 9 Aug 2021 15:34:30 +0100 From: John Garry To: , , CC: , , , , , , John Garry Subject: [PATCH v2 03/11] blk-mq: Relocate shared sbitmap resize in blk_mq_update_nr_requests() Date: Mon, 9 Aug 2021 22:29:30 +0800 Message-ID: <1628519378-211232-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1628519378-211232-1-git-send-email-john.garry@huawei.com> References: <1628519378-211232-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 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.26.2 Reviewed-by: Ming Lei diff --git a/block/blk-mq.c b/block/blk-mq.c index ae28f470893c..0e4825ca9869 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,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);