Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1926765pxb; Mon, 13 Sep 2021 08:19:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7Q2m8D47kuEra2nlJZpKSBSFCKigmCqboJ8Ca8rDXlnYzbsrVZoUIUPgaFY1rR59BraeD X-Received: by 2002:a05:6638:381d:: with SMTP id i29mr10298950jav.29.1631546360798; Mon, 13 Sep 2021 08:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631546360; cv=none; d=google.com; s=arc-20160816; b=pKhDblMP85NHspn4c+kpKCATnKQ8AT38vbPjLL/ouMrvFa2yiAz9FCLwhM8oZz9/4h +6+vMiQQKnXgbEi+QhSou5Pfiu94nARroV7om5yxUKmeD5jgYdB/trT4fG+Rp3Igf4eF /9xffb886pemeoEQbX1A0wiX5tEPG/IXSUvmG5mlppSJRq2i4u/kCwCxPVJ3XmGNKpYv FAHV4Ll6hb/aG/m8CcZu4gs0tkKYLHbbc2rW0pvZwJucMyv0p5psblhyqYY/bqTa9vAa UuSAA1zcRYcJ28+kKTC4dbas8Fv9NZNZ5yhtfNk/rDbUq9BVAmOZWSxY1uqirX+if2S3 To4Q== 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=f0tfAMFCBW6sOZY/+QHYYhNfAKjYxwN1+N69po9vxrboi1agY0lnOw8BetwQUgDJbg X7ZntsJGV8peNeq82N1+vzN2K8SFLbQVQ3DSeItf6VmmT0N/ehES9uzPrW3MRK2AuR9E gSxT7puIYR4NKVBWID7GxrOoqeYscxkIIWchhE42W4h1c2ogqaAlNPgt4bMbDFGmtTTU 3mIbQFOG9vG7TaJbVm744s0/kRPsMTTYnEG5l81d9PtyPwuFWO0bjXcBGnkcr1Cpemmv 8Ly5ZccZti3Km4kbQAMte9QUX7VaoDyno0emQ01EOE/lmqErpLaGSCB6jFcAIeWi4Jup DDDQ== ARC-Authentication-Results: i=1; mx.google.com; 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=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 186si6919132jaf.38.2021.09.13.08.19.06; Mon, 13 Sep 2021 08:19:20 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347079AbhIMPS7 (ORCPT + 99 others); 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 Content-Type: text/plain 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-kernel@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(-) 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); -- 2.26.2